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)]
20 pub struct Attribute(Boxed<ffi::PangoAttribute>);
21
22 match fn {
23 copy => |ptr| ffi::pango_attribute_copy(ptr),
24 free => |ptr| ffi::pango_attribute_destroy(ptr),
25 type_ => || ffi::pango_attribute_get_type(),
26 }
27}
28
29#[cfg(not(any(feature = "v1_44")))]
30glib::wrapper! {
31 #[derive(Debug, PartialOrd, Ord, Hash)]
32 pub struct Attribute(Boxed<ffi::PangoAttribute>);
33
34 match fn {
35 copy => |ptr| ffi::pango_attribute_copy(ptr),
36 free => |ptr| ffi::pango_attribute_destroy(ptr),
37 }
38}
39
40impl Attribute {
41 #[doc(alias = "pango_attribute_equal")]
42 fn equal(&self, attr2: &Attribute) -> bool {
43 unsafe {
44 from_glib(ffi::pango_attribute_equal(
45 self.to_glib_none().0,
46 attr2.to_glib_none().0,
47 ))
48 }
49 }
50}
51
52impl PartialEq for Attribute {
53 #[inline]
54 fn eq(&self, other: &Self) -> bool {
55 self.equal(other)
56 }
57}
58
59impl Eq for Attribute {}
60
61unsafe impl Send for Attribute {}
62unsafe impl Sync for Attribute {}