pub struct Ctl { /* private fields */ }
Expand description
This struct represents a system control.
Implementations§
Trait Implementations§
Source§impl IntoIterator for Ctl
impl IntoIterator for Ctl
Ctl implements the IntoIterator trait to allow for easy iteration over nodes.
§Example
let kern = sysctl::Ctl::new("kernel");
for ctl in kern {
println!("{}", ctl.name().unwrap());
}
Source§impl Sysctl for Ctl
impl Sysctl for Ctl
Source§fn new_with_type(
name: &str,
_ctl_type: CtlType,
_fmt: &str,
) -> Result<Self, SysctlError>
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>
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>
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>
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>
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_string(&self) -> Result<String, SysctlError>
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 value_as<T>(&self) -> Result<Box<T>, SysctlError>
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 set_value(&self, value: CtlValue) -> Result<CtlValue, SysctlError>
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>
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
impl StructuralPartialEq for Ctl
Auto Trait Implementations§
impl Freeze for Ctl
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more