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