1use crate::ffi;
6use glib::translate::*;
7
8#[cfg(feature = "v1_44")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
10glib::wrapper! {
11 #[derive(Debug, PartialOrd, Ord, Hash)]
12 pub struct Attribute(Boxed<ffi::PangoAttribute>);
13
14 match fn {
15 copy => |ptr| ffi::pango_attribute_copy(ptr),
16 free => |ptr| ffi::pango_attribute_destroy(ptr),
17 type_ => || ffi::pango_attribute_get_type(),
18 }
19}
20
21#[cfg(not(any(feature = "v1_44")))]
22glib::wrapper! {
23 #[derive(Debug, PartialOrd, Ord, Hash)]
24 pub struct Attribute(Boxed<ffi::PangoAttribute>);
25
26 match fn {
27 copy => |ptr| ffi::pango_attribute_copy(ptr),
28 free => |ptr| ffi::pango_attribute_destroy(ptr),
29 }
30}
31
32impl Attribute {
33 #[doc(alias = "pango_attribute_equal")]
34 fn equal(&self, attr2: &Attribute) -> bool {
35 unsafe {
36 from_glib(ffi::pango_attribute_equal(
37 self.to_glib_none().0,
38 attr2.to_glib_none().0,
39 ))
40 }
41 }
42}
43
44impl PartialEq for Attribute {
45 #[inline]
46 fn eq(&self, other: &Self) -> bool {
47 self.equal(other)
48 }
49}
50
51impl Eq for Attribute {}
52
53unsafe impl Send for Attribute {}
54unsafe impl Sync for Attribute {}