1 // Take a look at the license at the top of the repository in the LICENSE file. 2 3 use crate::Attribute; 4 use crate::Font; 5 use crate::Gravity; 6 use crate::Language; 7 use crate::Script; 8 use glib::translate::*; 9 10 #[repr(C)] 11 #[doc(alias = "PangoAnalysis")] 12 pub struct Analysis(ffi::PangoAnalysis); 13 14 impl Analysis { font(&self) -> Font15 pub fn font(&self) -> Font { 16 unsafe { from_glib_none(self.0.font) } 17 } 18 level(&self) -> u819 pub fn level(&self) -> u8 { 20 self.0.level 21 } 22 gravity(&self) -> Gravity23 pub fn gravity(&self) -> Gravity { 24 unsafe { from_glib(self.0.gravity as i32) } 25 } 26 flags(&self) -> u827 pub fn flags(&self) -> u8 { 28 self.0.flags 29 } 30 script(&self) -> Script31 pub fn script(&self) -> Script { 32 unsafe { from_glib(self.0.script as i32) } 33 } 34 language(&self) -> Language35 pub fn language(&self) -> Language { 36 unsafe { from_glib_none(self.0.language) } 37 } 38 extra_attrs(&self) -> Vec<Attribute>39 pub fn extra_attrs(&self) -> Vec<Attribute> { 40 unsafe { FromGlibPtrContainer::from_glib_none(self.0.extra_attrs) } 41 } 42 } 43 44 #[doc(hidden)] 45 impl<'a> ToGlibPtr<'a, *const ffi::PangoAnalysis> for Analysis { 46 type Storage = &'a Self; 47 48 #[inline] to_glib_none(&'a self) -> Stash<'a, *const ffi::PangoAnalysis, Self>49 fn to_glib_none(&'a self) -> Stash<'a, *const ffi::PangoAnalysis, Self> { 50 let ptr: *const ffi::PangoAnalysis = &self.0; 51 Stash(ptr, self) 52 } 53 } 54 55 #[doc(hidden)] 56 impl<'a> ToGlibPtrMut<'a, *mut ffi::PangoAnalysis> for Analysis { 57 type Storage = &'a mut Self; 58 59 #[inline] to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut ffi::PangoAnalysis, Self>60 fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut ffi::PangoAnalysis, Self> { 61 let ptr: *mut ffi::PangoAnalysis = &mut self.0; 62 StashMut(ptr, self) 63 } 64 } 65 66 #[doc(hidden)] 67 impl FromGlibPtrNone<*const ffi::PangoAnalysis> for Analysis { from_glib_none(ptr: *const ffi::PangoAnalysis) -> Self68 unsafe fn from_glib_none(ptr: *const ffi::PangoAnalysis) -> Self { 69 Self(*ptr) 70 } 71 } 72 73 #[doc(hidden)] 74 impl FromGlibPtrNone<*mut ffi::PangoAnalysis> for Analysis { from_glib_none(ptr: *mut ffi::PangoAnalysis) -> Self75 unsafe fn from_glib_none(ptr: *mut ffi::PangoAnalysis) -> Self { 76 Self(*ptr) 77 } 78 } 79