pub struct NetworkService { /* private fields */ }Implementations§
Source§impl NetworkService
impl NetworkService
pub fn type_id() -> u64
Sourcepub fn copy_all(preferences: &Preferences) -> Vec<Self>
pub fn copy_all(preferences: &Preferences) -> Vec<Self>
Examples found in repository?
examples/09_network_protocol.rs (line 5)
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 create( preferences: &Preferences, interface: &NetworkInterface, ) -> Result<Self>
pub fn copy(preferences: &Preferences, service_id: &str) -> Result<Option<Self>>
Sourcepub fn copy_protocols(&self) -> Vec<NetworkProtocol>
pub fn copy_protocols(&self) -> Vec<NetworkProtocol>
Examples found in repository?
examples/06_network_services.rs (line 11)
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}More examples
examples/09_network_protocol.rs (line 7)
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 copy_protocol( &self, protocol_type: &str, ) -> Result<Option<NetworkProtocol>>
pub fn add_protocol_type(&self, protocol_type: &str) -> Result<()>
pub fn establish_default_configuration(&self) -> Result<()>
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Examples found in repository?
examples/06_network_services.rs (line 9)
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}pub fn interface(&self) -> Option<NetworkInterface>
Sourcepub fn name(&self) -> Result<Option<String>>
pub fn name(&self) -> Result<Option<String>>
Examples found in repository?
examples/06_network_services.rs (line 10)
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}Sourcepub fn service_id(&self) -> Result<Option<String>>
pub fn service_id(&self) -> Result<Option<String>>
Examples found in repository?
examples/06_network_services.rs (line 8)
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}pub fn remove(&self) -> Result<()>
pub fn remove_protocol_type(&self, protocol_type: &str) -> Result<()>
pub fn set_enabled(&self, enabled: bool) -> Result<()>
pub fn set_name(&self, name: Option<&str>) -> Result<()>
Trait Implementations§
Source§impl Clone for NetworkService
impl Clone for NetworkService
Source§fn clone(&self) -> NetworkService
fn clone(&self) -> NetworkService
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 NetworkService
impl RefUnwindSafe for NetworkService
impl !Send for NetworkService
impl !Sync for NetworkService
impl Unpin for NetworkService
impl UnsafeUnpin for NetworkService
impl UnwindSafe for NetworkService
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