[][src]Enum rctl::Subject

pub enum Subject {
    Process(Process),
    Jail(Jail),
    User(User),
    LoginClass(LoginClass),
}

A struct representing an RCTL subject.

From rctl(8):

Subject defines the kind of entity the rule applies to. It can be either process, user, login class, or jail.

Subject ID identifies the subject. It can be user name, numerical user ID login class name, or jail name.

Variants

Process(Process)
Jail(Jail)
User(User)
LoginClass(LoginClass)

Implementations

impl Subject[src]

pub fn process_id(pid: pid_t) -> Self[src]

pub fn user_name(name: &str) -> Result<Self, ParseError>[src]

pub fn user_id(uid: uid_t) -> Self[src]

pub fn login_class<S: Into<String>>(name: S) -> Self[src]

pub fn jail_name<S: Into<String>>(name: S) -> Self[src]

pub fn usage(&self) -> Result<HashMap<Resource, usize>, Error>[src]

Get the resource usage for a specific [Subject].

Example

extern crate libc;

let uid = unsafe { libc::getuid() };
let subject = rctl::Subject::user_id(uid);

let usage = subject.usage()
    .expect("Could not get RCTL usage");

println!("{:#?}", usage);

pub fn limits(&self) -> Result<RuleParsingIntoIter<String>, Error>[src]

Get an IntoIterator over the rules that apply to this subject.

Trait Implementations

impl Clone for Subject[src]

impl Debug for Subject[src]

impl Display for Subject[src]

impl Eq for Subject[src]

impl<'a> From<&'a Subject> for SubjectType[src]

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

impl From<Subject> for Filter[src]

impl FromStr for Subject[src]

type Err = ParseError

The associated error which can be returned from parsing.

impl Hash for Subject[src]

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

impl PartialEq<Subject> for Subject[src]

impl StructuralEq for Subject[src]

impl StructuralPartialEq for Subject[src]

Auto Trait Implementations

impl RefUnwindSafe for Subject

impl Send for Subject

impl Sync for Subject

impl Unpin for Subject

impl UnwindSafe for Subject

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.