[−][src]Struct rctl::Filter
A filter can match a set of Rules.
Methods
impl Filter
[src]
impl Filter
pub fn new() -> Filter
[src]
pub fn new() -> Filter
Return the filter that matches all rules
Example
let filter = Filter::new(); assert_eq!(filter.to_string(), ":".to_string());
pub fn subject_type(self: Filter, subject_type: &SubjectType) -> Filter
[src]
pub fn subject_type(self: Filter, subject_type: &SubjectType) -> Filter
Constrain the filter to a specific [SubjectType]
If the filter is already constrained to a subject, this is a No-Op.
Example
let filter = Filter::new() .subject_type(&SubjectType::LoginClass); assert_eq!(filter.to_string(), "loginclass:".to_string());
pub fn subject(self: Filter, subject: &Subject) -> Filter
[src]
pub fn subject(self: Filter, subject: &Subject) -> Filter
Constrain the filter to a specific [Subject]
Resets the subject type.
Example
let filter = Filter::new() .subject(&Subject::user_name("nobody").expect("no user 'nobody'")); assert_eq!(filter.to_string(), "user:nobody".to_string());
pub fn resource(self: Filter, resource: &Resource) -> Filter
[src]
pub fn resource(self: Filter, resource: &Resource) -> Filter
Constrain the filter to a specific [Resource]
Example
let filter = Filter::new() .resource(&Resource::MemoryLocked); assert_eq!(filter.to_string(), "::memorylocked".to_string());
pub fn action(self: Filter, action: &Action) -> Filter
[src]
pub fn action(self: Filter, action: &Action) -> Filter
Constrain the filter to a specific [Action]
Example
let filter = Filter::new() .action(&Action::Deny); assert_eq!(filter.to_string(), ":::deny".to_string());
pub fn deny(self: Filter) -> Filter
[src]
pub fn deny(self: Filter) -> Filter
Constrain the filter to the Deny [Action]
Example
let filter = Filter::new() .deny(); assert_eq!(filter, Filter::new().action(&Action::Deny));
pub fn log(self: Filter) -> Filter
[src]
pub fn log(self: Filter) -> Filter
Constrain the filter to the Log [Action]
Example
let filter = Filter::new() .log(); assert_eq!(filter, Filter::new().action(&Action::Log));
pub fn devctl(self: Filter) -> Filter
[src]
pub fn devctl(self: Filter) -> Filter
Constrain the filter to the DevCtl [Action]
Example
let filter = Filter::new() .devctl(); assert_eq!(filter, Filter::new().action(&Action::DevCtl));
pub fn signal(self: Filter, signal: Signal) -> Filter
[src]
pub fn signal(self: Filter, signal: Signal) -> Filter
Constrain the filter to the Signal [Action]
Example
let filter = Filter::new() .signal(Signal::SIGTERM); assert_eq!(filter.to_string(), ":::sigterm".to_string());
pub fn limit(self: Filter, limit: &Limit) -> Filter
[src]
pub fn limit(self: Filter, limit: &Limit) -> Filter
Constrain the filter to a particular [Limit]
Resets any limit_per, if the given limit has a per
set.
Examples
let filter = Filter::new() .limit(&Limit::amount(100*1024*1024)); assert_eq!(filter.to_string(), ":::=100m".to_string());
let filter = Filter::new() .limit(&Limit::amount_per(100*1024*1024, SubjectType::Process)); assert_eq!(filter.to_string(), ":::=100m/process".to_string());
pub fn to_string(&self) -> String
[src]
pub fn to_string(&self) -> String
Return the string representation of the [Filter].
pub fn rules(&self) -> Result<RuleParsingIntoIter<String>, Error>
[src]
pub fn rules(&self) -> Result<RuleParsingIntoIter<String>, Error>
Return an [IntoIterator] over all Rules matching this [Filter].
Example
List all rules:
use rctl; let filter = rctl::Filter::new(); for rule in filter.rules() { println!("{:?}", rule); }
pub fn remove_rules(&self) -> Result<(), Error>
[src]
pub fn remove_rules(&self) -> Result<(), Error>
Remove all matching Rules from the resource limits database.
Examples
use rctl::{Filter, Subject}; let filter = Filter::new() .subject(&Subject::jail_name("testjail_rctl_filter_remove")) .remove_rules() .expect("Could not remove rules");
Remove all rules, clearing the resource limits database by using the
default (':'
) [Filter]:
use rctl; rctl::Filter::new().remove_rules().expect("Could not remove all rules");
Trait Implementations
impl<'a> Into<String> for &'a Filter
[src]
impl<'a> Into<String> for &'a Filter
impl PartialEq<Filter> for Filter
[src]
impl PartialEq<Filter> for Filter
fn eq(&self, other: &Filter) -> bool
[src]
fn eq(&self, other: &Filter) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Filter) -> bool
[src]
fn ne(&self, other: &Filter) -> bool
This method tests for !=
.
impl From<Rule> for Filter
[src]
impl From<Rule> for Filter
impl<'a> From<&'a Rule> for Filter
[src]
impl<'a> From<&'a Rule> for Filter
impl<'a> From<&'a Subject> for Filter
[src]
impl<'a> From<&'a Subject> for Filter
impl From<Subject> for Filter
[src]
impl From<Subject> for Filter
impl<'a> From<&'a SubjectType> for Filter
[src]
impl<'a> From<&'a SubjectType> for Filter
fn from(subject_type: &'a SubjectType) -> Self
[src]
fn from(subject_type: &'a SubjectType) -> Self
Performs the conversion.
impl From<SubjectType> for Filter
[src]
impl From<SubjectType> for Filter
fn from(subject_type: SubjectType) -> Self
[src]
fn from(subject_type: SubjectType) -> Self
Performs the conversion.
impl<'a> From<&'a Action> for Filter
[src]
impl<'a> From<&'a Action> for Filter
impl From<Action> for Filter
[src]
impl From<Action> for Filter
impl<'a> From<&'a Limit> for Filter
[src]
impl<'a> From<&'a Limit> for Filter
impl From<Limit> for Filter
[src]
impl From<Limit> for Filter
impl Clone for Filter
[src]
impl Clone for Filter
fn clone(&self) -> Filter
[src]
fn clone(&self) -> Filter
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Display for Filter
[src]
impl Display for Filter
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Debug for Filter
[src]
impl Debug for Filter
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> ToString for T where
T: Display + ?Sized,
[src]
impl<T> ToString for T where
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more