pango/attr_language.rs
1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4
5use crate::{ffi, AttrType, Language};
6
7define_attribute_struct!(AttrLanguage, ffi::PangoAttrLanguage, &[AttrType::Language]);
8
9impl AttrLanguage {
10 /// Create a new language tag attribute.
11 /// ## `language`
12 /// language tag
13 ///
14 /// # Returns
15 ///
16 /// the newly allocated
17 /// [`Attribute`][crate::Attribute], which should be freed with
18 /// `Pango::Attribute::destroy()`
19 #[doc(alias = "pango_attr_language_new")]
20 pub fn new(language: &Language) -> Self {
21 unsafe {
22 from_glib_full(ffi::pango_attr_language_new(mut_override(
23 language.to_glib_none().0,
24 )))
25 }
26 }
27
28 pub fn value(&self) -> Language {
29 unsafe { from_glib_none(self.inner.value) }
30 }
31}