Enum sysctl::Ctl

source ·
pub enum Ctl {
    Oid(Vec<c_int>),
    Name(String, CtlType, String),
}
Expand description

This struct represents a system control.

Variants§

Implementations§

source§

impl Ctl

source

pub fn oid(&self) -> Option<&Vec<c_int>>

Trait Implementations§

source§

impl Clone for Ctl

source§

fn clone(&self) -> Ctl

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Ctl

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl FromStr for Ctl

§

type Err = SysctlError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl IntoIterator for Ctl

Ctl implements the IntoIterator trait to allow for easy iteration over nodes.

Example

use sysctl::Sysctl;

let kern = sysctl::Ctl::new("kern");
for ctl in kern {
    println!("{}", ctl.name().unwrap());
}
§

type Item = Result<Ctl, SysctlError>

The type of the elements being iterated over.
§

type IntoIter = CtlIter

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl PartialEq for Ctl

source§

fn eq(&self, other: &Ctl) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Sysctl for Ctl

source§

fn new(name: &str) -> Result<Self, SysctlError>

Construct a Ctl from the name. Read more
source§

fn new_with_type( name: &str, _ctl_type: CtlType, _fmt: &str ) -> Result<Self, SysctlError>

Construct a Ctl from the name, type and format. Read more
source§

fn name(&self) -> Result<String, SysctlError>

Returns a result containing the sysctl name on success, or a SysctlError on failure. Read more
source§

fn value_type(&self) -> Result<CtlType, SysctlError>

Returns a result containing the sysctl value type on success, or a Sysctl Error on failure. Read more
source§

fn description(&self) -> Result<String, SysctlError>

Returns a result containing the sysctl description if success, or an Error on failure. Read more
source§

fn value(&self) -> Result<CtlValue, SysctlError>

Returns a result containing the sysctl value on success, or a SysctlError on failure. Read more
source§

fn value_as<T>(&self) -> Result<Box<T>, SysctlError>

A generic method that takes returns a result containing the sysctl value if success, or a SysctlError on failure. Read more
source§

fn value_string(&self) -> Result<String, SysctlError>

Returns a result containing the sysctl value as String on success, or a SysctlError on failure. Read more
source§

fn set_value(&self, value: CtlValue) -> Result<CtlValue, SysctlError>

Sets the value of a sysctl. Fetches and returns the new value if successful, or returns a SysctlError on failure. Read more
source§

fn set_value_string(&self, value: &str) -> Result<String, SysctlError>

Sets the value of a sysctl with input as string. Fetches and returns the new value if successful, or returns a SysctlError on failure. Read more
source§

fn flags(&self) -> Result<CtlFlags, SysctlError>

Get the flags for a sysctl. Read more
source§

fn info(&self) -> Result<CtlInfo, SysctlError>

Returns a Result containing the control metadata for a sysctl. Read more
source§

impl StructuralPartialEq for Ctl

Auto Trait Implementations§

§

impl RefUnwindSafe for Ctl

§

impl Send for Ctl

§

impl Sync for Ctl

§

impl Unpin for Ctl

§

impl UnwindSafe for Ctl

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.