pango/attr_class.rs
1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use std::marker::PhantomData;
4
5use glib::translate::*;
6
7use crate::{ffi, AttrType};
8
9#[doc(hidden)]
10impl<'a> ToGlibPtr<'a, *mut ffi::PangoAttrClass> for &'a AttrClass {
11 type Storage = PhantomData<&'a AttrClass>;
12
13 #[inline]
14 fn to_glib_none(&self) -> Stash<'a, *mut ffi::PangoAttrClass, Self> {
15 Stash(self.0, PhantomData)
16 }
17}
18
19#[doc(hidden)]
20impl FromGlibPtrNone<*mut ffi::PangoAttrClass> for AttrClass {
21 #[inline]
22 unsafe fn from_glib_none(ptr: *mut ffi::PangoAttrClass) -> Self {
23 debug_assert!(!ptr.is_null());
24 Self(ptr)
25 }
26}
27
28#[doc(hidden)]
29impl FromGlibPtrFull<*mut ffi::PangoAttrClass> for AttrClass {
30 #[inline]
31 unsafe fn from_glib_full(ptr: *mut ffi::PangoAttrClass) -> Self {
32 debug_assert!(!ptr.is_null());
33 Self(ptr)
34 }
35}
36
37#[doc(hidden)]
38impl FromGlibPtrNone<*const ffi::PangoAttrClass> for AttrClass {
39 #[inline]
40 unsafe fn from_glib_none(ptr: *const ffi::PangoAttrClass) -> Self {
41 debug_assert!(!ptr.is_null());
42 Self(ptr as *mut _)
43 }
44}
45
46#[doc(hidden)]
47impl FromGlibPtrFull<*const ffi::PangoAttrClass> for AttrClass {
48 #[inline]
49 unsafe fn from_glib_full(ptr: *const ffi::PangoAttrClass) -> Self {
50 debug_assert!(!ptr.is_null());
51 Self(ptr as *mut _)
52 }
53}
54
55#[doc(alias = "PangoAttrClass")]
56pub struct AttrClass(*mut ffi::PangoAttrClass);
57
58impl AttrClass {
59 #[inline]
60 pub fn type_(&self) -> AttrType {
61 unsafe { from_glib((*self.0).type_) }
62 }
63}
64
65impl PartialEq for AttrClass {
66 #[inline]
67 fn eq(&self, other: &AttrClass) -> bool {
68 self.0 == other.0
69 }
70}
71
72impl Eq for AttrClass {}