Enum sysctl::CtlValue

source ·
pub enum CtlValue {
Show 16 variants None, Node(Vec<u8>), Int(i32), String(String), S64(i64), Struct(Vec<u8>), Uint(u32), Long(i64), Ulong(u64), U64(u64), U8(u8), U16(u16), S8(i8), S16(i16), S32(i32), U32(u32),
}
Expand description

An Enum that holds all values returned by sysctl calls. Extract inner value with accessors like as_int().

Example

if let Ok(ctl) = sysctl::Ctl::new("kern.osrevision") {
    if let Ok(r) = ctl.value() {
        if let Some(val) = r.as_int() {
            println!("Value: {}", val);
        }
    }
}

Variants§

§

None

§

Node(Vec<u8>)

§

Int(i32)

§

String(String)

§

S64(i64)

§

Struct(Vec<u8>)

§

Uint(u32)

§

Long(i64)

§

Ulong(u64)

§

U64(u64)

§

U8(u8)

§

U16(u16)

§

S8(i8)

§

S16(i16)

§

S32(i32)

§

U32(u32)

Implementations§

Returns true if this is a CtlValue::None, otherwise false

Optionally returns mutable references to the inner fields if this is a CtlValue::Node, otherwise None

Optionally returns references to the inner fields if this is a CtlValue::Node, otherwise None

Returns the inner fields if this is a CtlValue::Node, otherwise returns back the enum in the Err case of the result

Optionally returns mutable references to the inner fields if this is a CtlValue::Int, otherwise None

Optionally returns references to the inner fields if this is a CtlValue::Int, otherwise None

Returns the inner fields if this is a CtlValue::Int, otherwise returns back the enum in the Err case of the result

Optionally returns mutable references to the inner fields if this is a CtlValue::String, otherwise None

Optionally returns references to the inner fields if this is a CtlValue::String, otherwise None

Returns the inner fields if this is a CtlValue::String, otherwise returns back the enum in the Err case of the result

Optionally returns mutable references to the inner fields if this is a CtlValue::S64, otherwise None

Optionally returns references to the inner fields if this is a CtlValue::S64, otherwise None

Returns the inner fields if this is a CtlValue::S64, otherwise returns back the enum in the Err case of the result

Optionally returns mutable references to the inner fields if this is a CtlValue::Struct, otherwise None

Optionally returns references to the inner fields if this is a CtlValue::Struct, otherwise None

Returns the inner fields if this is a CtlValue::Struct, otherwise returns back the enum in the Err case of the result

Optionally returns mutable references to the inner fields if this is a CtlValue::Uint, otherwise None

Optionally returns references to the inner fields if this is a CtlValue::Uint, otherwise None

Returns the inner fields if this is a CtlValue::Uint, otherwise returns back the enum in the Err case of the result

Optionally returns mutable references to the inner fields if this is a CtlValue::Long, otherwise None

Optionally returns references to the inner fields if this is a CtlValue::Long, otherwise None

Returns the inner fields if this is a CtlValue::Long, otherwise returns back the enum in the Err case of the result

Optionally returns mutable references to the inner fields if this is a CtlValue::Ulong, otherwise None

Optionally returns references to the inner fields if this is a CtlValue::Ulong, otherwise None

Returns the inner fields if this is a CtlValue::Ulong, otherwise returns back the enum in the Err case of the result

Optionally returns mutable references to the inner fields if this is a CtlValue::U64, otherwise None

Optionally returns references to the inner fields if this is a CtlValue::U64, otherwise None

Returns the inner fields if this is a CtlValue::U64, otherwise returns back the enum in the Err case of the result

Optionally returns mutable references to the inner fields if this is a CtlValue::U8, otherwise None

Optionally returns references to the inner fields if this is a CtlValue::U8, otherwise None

Returns the inner fields if this is a CtlValue::U8, otherwise returns back the enum in the Err case of the result

Optionally returns mutable references to the inner fields if this is a CtlValue::U16, otherwise None

Optionally returns references to the inner fields if this is a CtlValue::U16, otherwise None

Returns the inner fields if this is a CtlValue::U16, otherwise returns back the enum in the Err case of the result

Optionally returns mutable references to the inner fields if this is a CtlValue::S8, otherwise None

Optionally returns references to the inner fields if this is a CtlValue::S8, otherwise None

Returns the inner fields if this is a CtlValue::S8, otherwise returns back the enum in the Err case of the result

Optionally returns mutable references to the inner fields if this is a CtlValue::S16, otherwise None

Optionally returns references to the inner fields if this is a CtlValue::S16, otherwise None

Returns the inner fields if this is a CtlValue::S16, otherwise returns back the enum in the Err case of the result

Optionally returns mutable references to the inner fields if this is a CtlValue::S32, otherwise None

Optionally returns references to the inner fields if this is a CtlValue::S32, otherwise None

Returns the inner fields if this is a CtlValue::S32, otherwise returns back the enum in the Err case of the result

Optionally returns mutable references to the inner fields if this is a CtlValue::U32, otherwise None

Optionally returns references to the inner fields if this is a CtlValue::U32, otherwise None

Returns the inner fields if this is a CtlValue::U32, otherwise returns back the enum in the Err case of the result

Trait Implementations§

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.