cogl/
vertex_p2t2.rs

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