1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
use glib::translate::*;
glib_wrapper! {
#[derive(Debug, PartialOrd, Ord)] // Hash
pub struct Vertex(Boxed<ffi::ClutterVertex>);
match fn {
copy => |ptr| ffi::clutter_vertex_copy(mut_override(ptr)),
free => |ptr| ffi::clutter_vertex_free(ptr),
get_type => || ffi::clutter_vertex_get_type(),
}
}
impl Vertex {
/// Allocates a new, empty `Vertex`.
///
/// # Returns
///
/// the newly allocated `Vertex`.
/// Use `Vertex::free` to free its resources
pub fn alloc() -> Vertex {
unsafe { from_glib_full(ffi::clutter_vertex_alloc()) }
}
/// Creates a new `Vertex` for the point in 3D space
/// identified by the 3 coordinates `x`, `y`, `z`.
///
/// This function is the logical equivalent of:
///
///
/// ```text
/// clutter_vertex_init (clutter_vertex_alloc (), x, y, z);
/// ```
/// ## `x`
/// X coordinate
/// ## `y`
/// Y coordinate
/// ## `z`
/// Z coordinate
///
/// # Returns
///
/// the newly allocated `Vertex`.
/// Use `Vertex::free` to free the resources
pub fn new(x: f32, y: f32, z: f32) -> Vertex {
unsafe { from_glib_full(ffi::clutter_vertex_new(x, y, z)) }
}
/// Compares `self` and `vertex_b` for equality
/// ## `vertex_b`
/// a `Vertex`
///
/// # Returns
///
/// `true` if the passed `Vertex` are equal
fn equal(&self, vertex_b: &Vertex) -> bool {
unsafe {
from_glib(ffi::clutter_vertex_equal(
self.to_glib_none().0,
vertex_b.to_glib_none().0,
))
}
}
/// Initializes `self` with the given coordinates.
/// ## `x`
/// X coordinate
/// ## `y`
/// Y coordinate
/// ## `z`
/// Z coordinate
///
/// # Returns
///
/// the initialized `Vertex`
pub fn init(&mut self, x: f32, y: f32, z: f32) -> Option<Vertex> {
unsafe { from_glib_none(ffi::clutter_vertex_init(self.to_glib_none_mut().0, x, y, z)) }
}
}
impl PartialEq for Vertex {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.equal(other)
}
}
#[doc(hidden)]
impl Uninitialized for Vertex {
#[inline]
unsafe fn uninitialized() -> Self {
Self::alloc()
}
}
impl Eq for Vertex {}