nma4 0.1.2

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

use crate::{MobileFamily, ffi};
use glib::translate::*;

glib::wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct MobileAccessMethod(Shared<ffi::NMAMobileAccessMethod>);

    match fn {
        ref => |ptr| ffi::nma_mobile_access_method_ref(ptr),
        unref => |ptr| ffi::nma_mobile_access_method_unref(ptr),
        type_ => || ffi::nma_mobile_access_method_get_type(),
    }
}

impl MobileAccessMethod {
    #[doc(alias = "nma_mobile_access_method_get_3gpp_apn")]
    pub fn get_3gpp_apn(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::nma_mobile_access_method_get_3gpp_apn(
                self.to_glib_none().0,
            ))
        }
    }

    ///
    /// # Returns
    ///
    /// the list of DNS.
    #[doc(alias = "nma_mobile_access_method_get_dns")]
    #[doc(alias = "get_dns")]
    pub fn dns(&self) -> Vec<glib::GString> {
        unsafe {
            FromGlibPtrContainer::from_glib_none(ffi::nma_mobile_access_method_get_dns(
                self.to_glib_none().0,
            ))
        }
    }

    ///
    /// # Returns
    ///
    /// a #NMAMobileFamily.
    #[doc(alias = "nma_mobile_access_method_get_family")]
    #[doc(alias = "get_family")]
    pub fn family(&self) -> MobileFamily {
        unsafe {
            from_glib(ffi::nma_mobile_access_method_get_family(
                self.to_glib_none().0,
            ))
        }
    }

    ///
    /// # Returns
    ///
    /// the gateway.
    #[doc(alias = "nma_mobile_access_method_get_gateway")]
    #[doc(alias = "get_gateway")]
    pub fn gateway(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::nma_mobile_access_method_get_gateway(
                self.to_glib_none().0,
            ))
        }
    }

    ///
    /// # Returns
    ///
    /// the name of the method.
    #[doc(alias = "nma_mobile_access_method_get_name")]
    #[doc(alias = "get_name")]
    pub fn name(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::nma_mobile_access_method_get_name(
                self.to_glib_none().0,
            ))
        }
    }

    ///
    /// # Returns
    ///
    /// the password.
    #[doc(alias = "nma_mobile_access_method_get_password")]
    #[doc(alias = "get_password")]
    pub fn password(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::nma_mobile_access_method_get_password(
                self.to_glib_none().0,
            ))
        }
    }

    ///
    /// # Returns
    ///
    /// the username.
    #[doc(alias = "nma_mobile_access_method_get_username")]
    #[doc(alias = "get_username")]
    pub fn username(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::nma_mobile_access_method_get_username(
                self.to_glib_none().0,
            ))
        }
    }
}

impl std::fmt::Display for MobileAccessMethod {
    #[inline]
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.write_str(&self.name())
    }
}