impl Deref for NetworkManager and NetworkManagerSettings
This commit is contained in:
parent
52b613d284
commit
4704a1672d
2 changed files with 18 additions and 0 deletions
|
|
@ -11,11 +11,20 @@ use crate::{
|
|||
},
|
||||
settings::{connection::Connection, NetworkManagerSettings},
|
||||
};
|
||||
use std::ops::Deref;
|
||||
use zbus::{zvariant::ObjectPath, Result};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct NetworkManager<'a>(NetworkManagerProxy<'a>);
|
||||
|
||||
impl<'a> Deref for NetworkManager<'a> {
|
||||
type Target = NetworkManagerProxy<'a>;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> NetworkManager<'a> {
|
||||
pub async fn new(connection: &'a zbus::Connection) -> Result<NetworkManager<'a>> {
|
||||
NetworkManagerProxy::new(connection).await.map(Self)
|
||||
|
|
|
|||
|
|
@ -4,11 +4,20 @@ pub mod connection;
|
|||
|
||||
use self::connection::Connection;
|
||||
use crate::interface::settings::{connection::ConnectionSettingsProxy, SettingsProxy};
|
||||
use std::ops::Deref;
|
||||
use zbus::Result;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct NetworkManagerSettings<'a>(SettingsProxy<'a>);
|
||||
|
||||
impl<'a> Deref for NetworkManagerSettings<'a> {
|
||||
type Target = SettingsProxy<'a>;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> NetworkManagerSettings<'a> {
|
||||
pub async fn new(connection: &'a zbus::Connection) -> Result<NetworkManagerSettings<'a>> {
|
||||
SettingsProxy::new(connection).await.map(Self)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue