cogl/
vertex_p3.rs

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