[][src]Struct rctl::Limit

pub struct Limit { /* fields omitted */ }

Defines how much of a [Resource] a process can use beofore the defined [Action] triggers.

Implementations

impl Limit[src]

pub fn amount(amount: usize) -> Limit[src]

Construct a limit representing the amount used before an [Action] triggers.

The entity the amount gets accounted for defaults to the type of the [Subject] of the respective [Rule].

pub fn amount_per(amount: usize, per: SubjectType) -> Limit[src]

Limit the amount per [SubjectType].

This defines what entity the amount gets accounted for.

Examples

For example the following [Rule] means that each process of any user belonging to the login class "users" may allocate up to 100 MiB of virtual memory:

Rule {
    subject: Subject::login_class("users"),
    resource: Resource::VMemoryUse,
    action: Action::Deny,
    limit: Limit::amount_per(100*1024*1024, SubjectType::Process),
}

Setting per: Some(SubjectType::User) on the above [Rule] would mean that for each user belonging to the login class "users", the sum of virtual memory allocated by all the processes of that user will not exceed 100 MiB.

Setting per: Some(SubjectType::LoginClass) on the above [Rule] would mean that the sum of virtual memory allocated by all processes of all users belonging to that login class will not exceed 100 MiB.

pub fn to_string(&self) -> String[src]

Return the String representation of the Limit.

Trait Implementations

impl Clone for Limit[src]

impl Debug for Limit[src]

impl Display for Limit[src]

impl Eq for Limit[src]

impl<'a> From<&'a Limit> for Filter[src]

impl From<Limit> for Filter[src]

impl FromStr for Limit[src]

type Err = ParseError

The associated error which can be returned from parsing.

impl Hash for Limit[src]

impl<'a> Into<String> for &'a Limit[src]

impl PartialEq<Limit> for Limit[src]

impl StructuralEq for Limit[src]

impl StructuralPartialEq for Limit[src]

Auto Trait Implementations

impl RefUnwindSafe for Limit

impl Send for Limit

impl Sync for Limit

impl Unpin for Limit

impl UnwindSafe for Limit

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.