Skip to main content

ConnectionSettings

Struct ConnectionSettings 

Source
pub struct ConnectionSettings {
    pub object_path: OwnedObjectPath,
    pub id: Property<String>,
    pub uuid: Property<String>,
    pub connection_type: Property<ConnectionType>,
    pub wifi_ssid: Property<Option<Ssid>>,
    pub unsaved: Property<bool>,
    pub flags: Property<NMConnectionSettingsFlags>,
    pub filename: Property<String>,
    /* private fields */
}
Expand description

Connection Settings Profile.

Represents a single network connection configuration.

Fields§

§object_path: OwnedObjectPath

D-Bus object path for this settings connection.

§id: Property<String>

Human-readable connection name (e.g. “Home WiFi”, “Wired connection 1”).

§uuid: Property<String>

Stable unique identifier for this connection profile.

§connection_type: Property<ConnectionType>

Network connection type.

§wifi_ssid: Property<Option<Ssid>>

WiFi SSID, if this is a wireless connection.

§unsaved: Property<bool>

Whether the in-memory state differs from the on-disk state.

§flags: Property<NMConnectionSettingsFlags>

Additional flags of the connection profile.

§filename: Property<String>

File that stores the connection in case the connection is file-backed.

Implementations§

Source§

impl ConnectionSettings

Source

pub async fn update( &self, properties: HashMap<String, HashMap<String, OwnedValue>>, ) -> Result<(), Error>

Update the connection with new settings and properties (replacing all previous settings and properties) and save the connection to disk. Secrets may be part of the update request, and will be either stored in persistent storage or sent to a Secret Agent for storage, depending on the flags associated with each secret.

§Errors

Returns NetworkError::OperationFailed if the update operation fails.

Source

pub async fn update_unsaved( &self, properties: HashMap<String, HashMap<String, OwnedValue>>, ) -> Result<(), Error>

Update the connection without immediately saving to disk.

Update the connection with new settings and properties (replacing all previous settings and properties) but do not immediately save the connection to disk. Secrets may be part of the update request and may be sent to a Secret Agent for storage, depending on the flags associated with each secret. Use the ‘Save’ method to save these changes to disk. Note that unsaved changes will be lost if the connection is reloaded from disk (either automatically on file change or due to an explicit ReloadConnections call).

§Errors

Returns NetworkError::OperationFailed if the update operation fails.

Source

pub async fn delete(&self) -> Result<(), Error>

Delete the connection.

§Errors

Returns NetworkError::OperationFailed if the delete operation fails.

Source

pub async fn get_settings( &self, ) -> Result<HashMap<String, HashMap<String, OwnedValue>>, Error>

Get the settings maps describing this network configuration.

This will never include any secrets required for connection to the network, as those are often protected. Secrets must be requested separately using the GetSecrets() call.

§Errors

Returns NetworkError::OperationFailed if retrieving settings fails.

Source

pub async fn get_secrets( &self, setting_name: &str, ) -> Result<HashMap<String, HashMap<String, OwnedValue>>, Error>

Get the secrets belonging to this network configuration.

Only secrets from persistent storage or a Secret Agent running in the requestor’s session will be returned. The user will never be prompted for secrets as a result of this request.

§Arguments
  • setting_name - Name of the setting to return secrets for. If empty, all secrets will be returned.
§Errors

Returns NetworkError::OperationFailed if retrieving secrets fails.

Source

pub async fn clear_secrets(&self) -> Result<(), Error>

Clear the secrets belonging to this network connection profile.

§Errors

Returns NetworkError::OperationFailed if clearing secrets fails.

Source

pub async fn save(&self) -> Result<(), Error>

Saves a “dirty” connection to persistent storage.

Saves a connection (that had previously been updated with UpdateUnsaved) to persistent storage.

§Errors

Returns NetworkError::OperationFailed if saving fails.

Source

pub async fn update2( &self, settings: HashMap<String, HashMap<String, OwnedValue>>, flags: u32, args: HashMap<String, OwnedValue>, ) -> Result<HashMap<String, OwnedValue>, Error>

Update the connection with new settings and properties.

Update2 is an alternative to Update, UpdateUnsaved and Save extensible with extra flags and args arguments.

§Arguments
  • settings - New connection settings, properties, and (optionally) secrets. Provide an empty HashMap to use the current settings.
  • flags - Optional flags. Unknown flags cause the call to fail.
    • 0x1 (to-disk): The connection is persisted to disk.
    • 0x2 (in-memory): The change is only made in memory.
    • 0x4 (in-memory-detached): Like “in-memory”, but behaves slightly different when migrating.
    • 0x8 (in-memory-only): Like “in-memory”, but behaves slightly different when migrating.
    • 0x10 (volatile): Connection is volatile.
    • 0x20 (block-autoconnect): Blocks auto-connect on the updated profile.
    • 0x40 (no-reapply): Prevents “connection.zone” and “connection.metered” from taking effect on active devices.
  • args - Optional arguments dictionary. Accepts “plugin” and “version-id” keys.
§Errors

Returns NetworkError::OperationFailed if the update operation fails.

Source

pub async fn properties_changed_signal( &self, ) -> Result<impl Stream<Item = HashMap<String, OwnedValue>>, Error>

Emitted when any property of any settings object within this Connection has changed.

§Errors

Returns error if D-Bus proxy creation fails.

Source

pub async fn updated_signal(&self) -> Result<impl Stream<Item = ()>, Error>

Emitted when the connection is updated.

§Errors

Returns error if D-Bus proxy creation fails.

Source

pub async fn removed_signal(&self) -> Result<impl Stream<Item = ()>, Error>

Emitted when the connection is removed.

§Errors

Returns error if D-Bus proxy creation fails.

Trait Implementations§

Source§

impl Clone for ConnectionSettings

Source§

fn clone(&self) -> ConnectionSettings

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConnectionSettings

Source§

fn fmt(&self, __derive_more_f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ModelMonitoring for ConnectionSettings

Source§

type Error = Error

Error type for monitoring operations.
Source§

async fn start_monitoring(self: Arc<Self>) -> Result<(), Self::Error>

Starts monitoring for state changes with shared ownership. Read more
Source§

impl PartialEq for ConnectionSettings

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Reactive for ConnectionSettings

Source§

type Context<'a> = ConnectionSettingsParams<'a>

Context type for static fetching.
Source§

type LiveContext<'a> = LiveConnectionSettingsParams<'a>

Context type for live monitoring.
Source§

type Error = Error

Error type for reactive operations.
Source§

async fn get(params: Self::Context<'_>) -> Result<Self, Self::Error>

Fetches a static snapshot without monitoring.
Source§

async fn get_live( params: Self::LiveContext<'_>, ) -> Result<Arc<Self>, Self::Error>

Fetches with live monitoring and reactive updates.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more