1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
use crate::Script;
use glib::translate::*;
use std::fmt;
glib::wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Language(Boxed<ffi::PangoLanguage>);
match fn {
copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::pango_language_get_type(), ptr as *mut _) as *mut ffi::PangoLanguage,
free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::pango_language_get_type(), ptr as *mut _),
type_ => || ffi::pango_language_get_type(),
}
}
impl Language {
#[doc(alias = "pango_language_get_sample_string")]
#[doc(alias = "get_sample_string")]
pub fn sample_string(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::pango_language_get_sample_string(mut_override(
self.to_glib_none().0,
)))
}
}
#[doc(alias = "pango_language_includes_script")]
pub fn includes_script(&self, script: Script) -> bool {
unsafe {
from_glib(ffi::pango_language_includes_script(
mut_override(self.to_glib_none().0),
script.into_glib(),
))
}
}
#[doc(alias = "pango_language_matches")]
pub fn matches(&self, range_list: &str) -> bool {
unsafe {
from_glib(ffi::pango_language_matches(
mut_override(self.to_glib_none().0),
range_list.to_glib_none().0,
))
}
}
#[doc(alias = "pango_language_to_string")]
#[doc(alias = "to_string")]
pub fn to_str(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::pango_language_to_string(mut_override(
self.to_glib_none().0,
)))
}
}
#[doc(alias = "pango_language_from_string")]
pub fn from_string(language: &str) -> Language {
unsafe { from_glib_none(ffi::pango_language_from_string(language.to_glib_none().0)) }
}
#[doc(alias = "pango_language_get_default")]
#[doc(alias = "get_default")]
#[allow(clippy::should_implement_trait)]
pub fn default() -> Language {
unsafe { from_glib_none(ffi::pango_language_get_default()) }
}
}
impl fmt::Display for Language {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(&self.to_str())
}
}