cogl/
vertex_p2c4.rs

1use glib::translate::*;
2use std::mem;
3
4#[repr(C)]
5#[derive(Clone, Copy, Debug, PartialEq)]
6pub struct VertexP2C4 {
7    pub x: f32,
8    pub y: f32,
9    pub r: u8,
10    pub g: u8,
11    pub b: u8,
12    pub a: u8,
13}
14
15#[doc(hidden)]
16impl Uninitialized for VertexP2C4 {
17    #[inline]
18    unsafe fn uninitialized() -> Self {
19        mem::zeroed()
20    }
21}
22
23#[doc(hidden)]
24impl<'a> ToGlibPtr<'a, *const ffi::CoglVertexP2C4> for VertexP2C4 {
25    type Storage = &'a Self;
26
27    #[inline]
28    fn to_glib_none(&'a self) -> Stash<'a, *const ffi::CoglVertexP2C4, Self> {
29        let ptr: *const VertexP2C4 = &*self;
30        Stash(ptr as *const ffi::CoglVertexP2C4, self)
31    }
32}
33
34#[doc(hidden)]
35impl<'a> ToGlibPtrMut<'a, *mut ffi::CoglVertexP2C4> for VertexP2C4 {
36    type Storage = &'a mut Self;
37
38    #[inline]
39    fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut ffi::CoglVertexP2C4, Self> {
40        let ptr: *mut VertexP2C4 = &mut *self;
41        StashMut(ptr as *mut ffi::CoglVertexP2C4, self)
42    }
43}
44
45#[doc(hidden)]
46impl FromGlibPtrNone<*const ffi::CoglVertexP2C4> for VertexP2C4 {
47    unsafe fn from_glib_none(ptr: *const ffi::CoglVertexP2C4) -> Self {
48        *(ptr as *const VertexP2C4)
49    }
50}
51
52#[doc(hidden)]
53impl FromGlibPtrNone<*mut ffi::CoglVertexP2C4> for VertexP2C4 {
54    unsafe fn from_glib_none(ptr: *mut ffi::CoglVertexP2C4) -> Self {
55        *(ptr as *mut VertexP2C4)
56    }
57}
58
59#[doc(hidden)]
60impl FromGlibPtrBorrow<*mut ffi::CoglVertexP2C4> for VertexP2C4 {
61    unsafe fn from_glib_borrow(ptr: *mut ffi::CoglVertexP2C4) -> glib::translate::Borrowed<Self> {
62        glib::translate::Borrowed::new(*(ptr as *mut VertexP2C4))
63    }
64}
65
66#[doc(hidden)]
67impl FromGlibPtrBorrow<*const ffi::CoglVertexP2C4> for VertexP2C4 {
68    unsafe fn from_glib_borrow(ptr: *const ffi::CoglVertexP2C4) -> glib::translate::Borrowed<Self> {
69        glib::translate::Borrowed::new(*(ptr as *const VertexP2C4))
70    }
71}