pub struct Preferences { /* private fields */ }Implementations§
Source§impl Preferences
impl Preferences
Sourcepub fn new(name: &str, prefs_id: Option<&str>) -> Result<Self>
pub fn new(name: &str, prefs_id: Option<&str>) -> Result<Self>
Examples found in repository?
More examples
examples/06_network_services.rs (line 4)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let prefs = Preferences::new("systemconfiguration-rs.network-services-example", None)?;
5 for service in prefs.network_services() {
6 println!(
7 "id={:?} enabled={} name={:?} protocols={}",
8 service.service_id()?,
9 service.is_enabled(),
10 service.name()?,
11 service.copy_protocols().len()
12 );
13 }
14 Ok(())
15}examples/09_network_protocol.rs (line 4)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let prefs = Preferences::new("systemconfiguration-rs.network-protocol-example", None)?;
5 if let Some(protocol) = NetworkService::copy_all(&prefs)
6 .into_iter()
7 .flat_map(|service| service.copy_protocols())
8 .next()
9 {
10 println!(
11 "protocol_type={:?} enabled={} has_config={}",
12 protocol.protocol_type(),
13 protocol.is_enabled(),
14 protocol.configuration().is_some()
15 );
16 } else {
17 println!("no network protocols available");
18 }
19 Ok(())
20}pub fn lock(&self, wait: bool) -> Result<()>
pub fn commit_changes(&self) -> Result<()>
pub fn apply_changes(&self) -> Result<()>
pub fn unlock(&self) -> Result<()>
pub fn synchronize(&self)
Sourcepub fn copy_key_list(&self) -> Vec<String>
pub fn copy_key_list(&self) -> Vec<String>
pub fn add_value(&self, key: &str, value: &PropertyList) -> Result<()>
pub fn set_value(&self, key: &str, value: &PropertyList) -> Result<()>
pub fn remove_value(&self, key: &str) -> Result<()>
pub fn path_create_unique_child(&self, prefix: &str) -> Result<Option<String>>
pub fn path_get_value(&self, path: &str) -> Result<Option<PropertyList>>
pub fn path_get_link(&self, path: &str) -> Result<Option<String>>
pub fn path_set_value(&self, path: &str, value: &PropertyList) -> Result<()>
pub fn path_set_link(&self, path: &str, link: &str) -> Result<()>
pub fn path_remove_value(&self, path: &str) -> Result<()>
pub fn set_computer_name(&self, name: Option<&str>) -> Result<()>
pub fn set_local_host_name(&self, name: Option<&str>) -> Result<()>
Sourcepub fn network_services(&self) -> Vec<NetworkService>
pub fn network_services(&self) -> Vec<NetworkService>
Examples found in repository?
examples/06_network_services.rs (line 5)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let prefs = Preferences::new("systemconfiguration-rs.network-services-example", None)?;
5 for service in prefs.network_services() {
6 println!(
7 "id={:?} enabled={} name={:?} protocols={}",
8 service.service_id()?,
9 service.is_enabled(),
10 service.name()?,
11 service.copy_protocols().len()
12 );
13 }
14 Ok(())
15}Trait Implementations§
Source§impl Clone for Preferences
impl Clone for Preferences
Source§fn clone(&self) -> Preferences
fn clone(&self) -> Preferences
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Preferences
impl RefUnwindSafe for Preferences
impl !Send for Preferences
impl !Sync for Preferences
impl Unpin for Preferences
impl UnsafeUnpin for Preferences
impl UnwindSafe for Preferences
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