cogl/
vertex_p2.rs

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