pango/auto/
attribute.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::ffi;
6use glib::translate::*;
7
8#[cfg(feature = "v1_44")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
10glib::wrapper! {
11    /// The [`Attribute`][crate::Attribute] structure represents the common portions of all
12    /// attributes.
13    ///
14    /// Particular types of attributes include this structure as their initial
15    /// portion. The common portion of the attribute holds the range to which
16    /// the value in the type-specific part of the attribute applies and should
17    /// be initialized using `Pango::Attribute::init()`. By default, an attribute
18    /// will have an all-inclusive range of [0,`G_MAXUINT`].
19    #[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 {}