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::{ffi,MobileProvider};
use glib::{translate::*};

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

    match fn {
        ref => |ptr| ffi::nma_country_info_ref(ptr),
        unref => |ptr| ffi::nma_country_info_unref(ptr),
        type_ => || ffi::nma_country_info_get_type(),
    }
}

impl CountryInfo {
    ///
    /// # Returns
    ///
    /// the code of the country or [`None`] for "Unknown".
    #[doc(alias = "nma_country_info_get_country_code")]
    #[doc(alias = "get_country_code")]
    pub fn country_code(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::nma_country_info_get_country_code(self.to_glib_none().0))
        }
    }

    ///
    /// # Returns
    ///
    /// the name of the country.
    #[doc(alias = "nma_country_info_get_country_name")]
    #[doc(alias = "get_country_name")]
    pub fn country_name(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::nma_country_info_get_country_name(self.to_glib_none().0))
        }
    }

    ///
    /// # Returns
    ///
    /// the
    ///  list of #NMAMobileProvider this country exposes.
    #[doc(alias = "nma_country_info_get_providers")]
    #[doc(alias = "get_providers")]
    pub fn providers(&self) -> Vec<MobileProvider> {
        unsafe {
            FromGlibPtrContainer::from_glib_none(ffi::nma_country_info_get_providers(self.to_glib_none().0))
        }
    }
}