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
// Take a look at the license at the top of the repository in the LICENSE file.

use std::marker::PhantomData;

use glib::translate::*;

use crate::AttrType;

#[doc(hidden)]
impl<'a> ToGlibPtr<'a, *mut ffi::PangoAttrClass> for &'a AttrClass {
    type Storage = PhantomData<&'a AttrClass>;

    #[inline]
    fn to_glib_none(&self) -> Stash<'a, *mut ffi::PangoAttrClass, Self> {
        Stash(self.0, PhantomData)
    }
}

#[doc(hidden)]
impl FromGlibPtrNone<*mut ffi::PangoAttrClass> for AttrClass {
    #[inline]
    unsafe fn from_glib_none(ptr: *mut ffi::PangoAttrClass) -> Self {
        debug_assert!(!ptr.is_null());
        Self(ptr)
    }
}

#[doc(hidden)]
impl FromGlibPtrFull<*mut ffi::PangoAttrClass> for AttrClass {
    #[inline]
    unsafe fn from_glib_full(ptr: *mut ffi::PangoAttrClass) -> Self {
        debug_assert!(!ptr.is_null());
        Self(ptr)
    }
}

#[doc(hidden)]
impl FromGlibPtrNone<*const ffi::PangoAttrClass> for AttrClass {
    #[inline]
    unsafe fn from_glib_none(ptr: *const ffi::PangoAttrClass) -> Self {
        debug_assert!(!ptr.is_null());
        Self(ptr as *mut _)
    }
}

#[doc(hidden)]
impl FromGlibPtrFull<*const ffi::PangoAttrClass> for AttrClass {
    #[inline]
    unsafe fn from_glib_full(ptr: *const ffi::PangoAttrClass) -> Self {
        debug_assert!(!ptr.is_null());
        Self(ptr as *mut _)
    }
}

/// The [`AttrClass`][crate::AttrClass] structure stores the type and operations for
/// a particular type of attribute.
///
/// The functions in this structure should not be called directly. Instead,
/// one should use the wrapper functions provided for [`Attribute`][crate::Attribute].
#[doc(alias = "PangoAttrClass")]
pub struct AttrClass(*mut ffi::PangoAttrClass);

impl AttrClass {
    #[inline]
    pub fn type_(&self) -> AttrType {
        unsafe { from_glib((*self.0).type_) }
    }
}

impl PartialEq for AttrClass {
    #[inline]
    fn eq(&self, other: &AttrClass) -> bool {
        self.0 == other.0
    }
}

impl Eq for AttrClass {}