1use glib::translate::*;
6use pango_sys;
7use AttrClass;
8
9glib_wrapper! {
10 #[derive(Debug, PartialOrd, Ord, Hash)]
11 pub struct Attribute(Boxed<pango_sys::PangoAttribute>);
12
13 match fn {
14 copy => |ptr| pango_sys::pango_attribute_copy(mut_override(ptr)),
15 free => |ptr| pango_sys::pango_attribute_destroy(ptr),
16 }
17}
18
19impl Attribute {
20 fn equal(&self, attr2: &Attribute) -> bool {
21 unsafe {
22 from_glib(pango_sys::pango_attribute_equal(
23 self.to_glib_none().0,
24 attr2.to_glib_none().0,
25 ))
26 }
27 }
28
29 pub fn init(&mut self, klass: &AttrClass) {
30 unsafe {
31 pango_sys::pango_attribute_init(self.to_glib_none_mut().0, klass.to_glib_none().0);
32 }
33 }
34}
35
36impl PartialEq for Attribute {
37 #[inline]
38 fn eq(&self, other: &Self) -> bool {
39 self.equal(other)
40 }
41}
42
43impl Eq for Attribute {}