pub struct NetworkService {
pub settings: Arc<Settings>,
pub wifi: Property<Option<Arc<Wifi>>>,
pub wired: Property<Option<Arc<Wired>>>,
pub primary: Property<ConnectionType>,
/* private fields */
}Expand description
Entry point for network management. See crate-level docs for usage.
Fields§
§settings: Arc<Settings>Connection profile management.
wifi: Property<Option<Arc<Wifi>>>WiFi device, if present (live-updated on hot-plug).
wired: Property<Option<Arc<Wired>>>Wired device, if present (live-updated on hot-plug).
primary: Property<ConnectionType>Primary connection type as reported by NetworkManager.
Implementations§
Source§impl NetworkService
impl NetworkService
Sourcepub async fn new() -> Result<Self, Error>
pub async fn new() -> Result<Self, Error>
Starts the network service and initializes all components.
Performs device discovery, creates WiFi and wired service instances for available devices, and sets up property monitoring. Handles the actual initialization logic for the service.
§Errors
Returns NetworkError::ServiceInitializationFailed if:
- D-Bus connection fails
- Device discovery encounters errors
- Device proxy creation fails
Sourcepub async fn connection(
&self,
path: OwnedObjectPath,
) -> Result<ActiveConnection, Error>
pub async fn connection( &self, path: OwnedObjectPath, ) -> Result<ActiveConnection, Error>
Objects that implement the Connection.Active interface represent an attempt to connect to a network using the details provided by a Connection object.
§Errors
Returns NetworkError::ObjectNotFound if the connection doesn’t exist.
Returns NetworkError::DbusError if DBus operations fail.
Sourcepub async fn connection_monitored(
&self,
path: OwnedObjectPath,
) -> Result<Arc<ActiveConnection>, Error>
pub async fn connection_monitored( &self, path: OwnedObjectPath, ) -> Result<Arc<ActiveConnection>, Error>
Objects that implement the Connection.Active interface represent an attempt to connect to a network using the details provided by a Connection object. This variant monitors the connection for changes.
§Errors
Returns NetworkError::ObjectNotFound if the connection doesn’t exist.
Returns NetworkError::DbusError if DBus operations fail.
Sourcepub async fn access_point(
&self,
path: OwnedObjectPath,
) -> Result<AccessPoint, Error>
pub async fn access_point( &self, path: OwnedObjectPath, ) -> Result<AccessPoint, Error>
Wi-Fi Access Point.
§Errors
Returns NetworkError::ObjectNotFound if the access point doesn’t exist.
Returns NetworkError::ObjectCreationFailed if access point creation fails.
Sourcepub async fn access_point_monitored(
&self,
path: OwnedObjectPath,
) -> Result<Arc<AccessPoint>, Error>
pub async fn access_point_monitored( &self, path: OwnedObjectPath, ) -> Result<Arc<AccessPoint>, Error>
Wi-Fi Access Point. This variant monitors the access point for changes.
§Errors
Returns NetworkError::ObjectNotFound if the access point doesn’t exist.
Returns NetworkError::ObjectCreationFailed if access point creation fails.
Sourcepub async fn connection_settings(
&self,
path: OwnedObjectPath,
) -> Result<ConnectionSettings, Error>
pub async fn connection_settings( &self, path: OwnedObjectPath, ) -> Result<ConnectionSettings, Error>
Represents a single network connection configuration.
§Errors
Returns NetworkError::ObjectNotFound if the connection profile doesn’t exist.
Returns NetworkError::DbusError if DBus operations fail.
Sourcepub async fn connection_settings_monitored(
&self,
path: OwnedObjectPath,
) -> Result<Arc<ConnectionSettings>, Error>
pub async fn connection_settings_monitored( &self, path: OwnedObjectPath, ) -> Result<Arc<ConnectionSettings>, Error>
Represents a single network connection configuration. This variant monitors the connection settings for changes.
§Errors
Returns NetworkError::ObjectNotFound if the connection profile doesn’t exist.
Returns NetworkError::DbusError if DBus operations fail.
Sourcepub async fn device(&self, path: OwnedObjectPath) -> Result<Device, Error>
pub async fn device(&self, path: OwnedObjectPath) -> Result<Device, Error>
Represents a network device.
§Errors
Returns NetworkError::ObjectNotFound if the device doesn’t exist.
Returns NetworkError::DbusError if DBus operations fail.
Sourcepub async fn device_monitored(
&self,
path: OwnedObjectPath,
) -> Result<Arc<Device>, Error>
pub async fn device_monitored( &self, path: OwnedObjectPath, ) -> Result<Arc<Device>, Error>
Represents a network device. This variant monitors the device for changes.
§Errors
Returns NetworkError::ObjectNotFound if the device doesn’t exist.
Returns NetworkError::DbusError if DBus operations fail.
Sourcepub async fn device_wifi(
&self,
path: OwnedObjectPath,
) -> Result<DeviceWifi, Error>
pub async fn device_wifi( &self, path: OwnedObjectPath, ) -> Result<DeviceWifi, Error>
Represents a Wi-Fi device.
§Errors
Returns NetworkError::ObjectNotFound if the device doesn’t exist.
Returns NetworkError::WrongObjectType if the device is not a WiFi device.
Sourcepub async fn device_wifi_monitored(
&self,
path: OwnedObjectPath,
) -> Result<Arc<DeviceWifi>, Error>
pub async fn device_wifi_monitored( &self, path: OwnedObjectPath, ) -> Result<Arc<DeviceWifi>, Error>
Represents a Wi-Fi device. This variant monitors the device for changes.
§Errors
Returns NetworkError::ObjectNotFound if the device doesn’t exist.
Returns NetworkError::WrongObjectType if the device is not a WiFi device.
Sourcepub async fn device_wired(
&self,
path: OwnedObjectPath,
) -> Result<DeviceWired, Error>
pub async fn device_wired( &self, path: OwnedObjectPath, ) -> Result<DeviceWired, Error>
Represents a wired Ethernet device.
§Errors
Returns NetworkError::ObjectNotFound if the device doesn’t exist.
Returns NetworkError::WrongObjectType if the device is not an ethernet device.
Sourcepub async fn device_wired_monitored(
&self,
path: OwnedObjectPath,
) -> Result<Arc<DeviceWired>, Error>
pub async fn device_wired_monitored( &self, path: OwnedObjectPath, ) -> Result<Arc<DeviceWired>, Error>
Represents a wired Ethernet device. This variant monitors the device for changes.
§Errors
Returns NetworkError::ObjectNotFound if the device doesn’t exist.
Returns NetworkError::WrongObjectType if the device is not an ethernet device.
Sourcepub async fn ip4_config(
&self,
path: OwnedObjectPath,
) -> Result<Ip4Config, Error>
pub async fn ip4_config( &self, path: OwnedObjectPath, ) -> Result<Ip4Config, Error>
IPv4 Configuration Set.
§Errors
Returns NetworkError::ObjectNotFound if the configuration doesn’t exist.
Returns NetworkError::DbusError if DBus operations fail.
Sourcepub async fn ip6_config(
&self,
path: OwnedObjectPath,
) -> Result<Ip6Config, Error>
pub async fn ip6_config( &self, path: OwnedObjectPath, ) -> Result<Ip6Config, Error>
IPv6 Configuration Set.
§Errors
Returns NetworkError::ObjectNotFound if the configuration doesn’t exist.
Returns NetworkError::DbusError if DBus operations fail.
Sourcepub async fn dhcp4_config(
&self,
path: OwnedObjectPath,
) -> Result<Dhcp4Config, Error>
pub async fn dhcp4_config( &self, path: OwnedObjectPath, ) -> Result<Dhcp4Config, Error>
DHCP4 Configuration.
§Errors
Returns NetworkError::ObjectNotFound if the configuration doesn’t exist.
Returns NetworkError::DbusError if DBus operations fail.
Sourcepub async fn dhcp6_config(
&self,
path: OwnedObjectPath,
) -> Result<Dhcp6Config, Error>
pub async fn dhcp6_config( &self, path: OwnedObjectPath, ) -> Result<Dhcp6Config, Error>
DHCP6 Configuration.
§Errors
Returns NetworkError::ObjectNotFound if the configuration doesn’t exist.
Returns NetworkError::DbusError if DBus operations fail.
Sourcepub async fn check_permissions_signal(
&self,
) -> Result<impl Stream<Item = ()>, Error>
pub async fn check_permissions_signal( &self, ) -> Result<impl Stream<Item = ()>, Error>
Emitted when system authorization details change.
§Errors
Returns error if D-Bus proxy creation fails.