nm-rs 0.1.3

Rust bindings for the libnm library.
Documentation
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir
// from gtk-girs (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{Connection, ffi};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    ///
    ///
    /// # Implements
    ///
    /// [`ConnectionExt`][trait@crate::prelude::ConnectionExt]
    #[doc(alias = "NMSimpleConnection")]
    pub struct SimpleConnection(Object<ffi::NMSimpleConnection, ffi::NMSimpleConnectionClass>) @implements Connection;

    match fn {
        type_ => || ffi::nm_simple_connection_get_type(),
    }
}

impl SimpleConnection {
    /// Creates a new #NMSimpleConnection object with no #NMSetting objects.
    ///
    /// # Returns
    ///
    /// the new empty #NMConnection object
    #[doc(alias = "nm_simple_connection_new")]
    pub fn new() -> Connection {
        assert_initialized_main_thread!();
        unsafe { from_glib_full(ffi::nm_simple_connection_new()) }
    }

    /// Clones an #NMConnection as an #NMSimpleConnection.
    /// ## `connection`
    /// the #NMConnection to clone
    ///
    /// # Returns
    ///
    /// a new #NMConnection containing the same settings
    /// and properties as the source #NMConnection
    #[doc(alias = "nm_simple_connection_new_clone")]
    pub fn new_clone(connection: &impl IsA<Connection>) -> Connection {
        skip_assert_initialized!();
        unsafe {
            from_glib_full(ffi::nm_simple_connection_new_clone(
                connection.as_ref().to_glib_none().0,
            ))
        }
    }

    //#[doc(alias = "nm_simple_connection_new_from_dbus")]
    //pub fn new_from_dbus(dict: /*Ignored*/&glib::Variant) -> Result<Connection, glib::Error> {
    //    unsafe { TODO: call ffi:nm_simple_connection_new_from_dbus() }
    //}
}

impl Default for SimpleConnection {
    fn default() -> Self {
        Self::new()
            .downcast()
            .expect("Casting from SimpleConnection should not panic.")
    }
}