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
use glib::translate::*;
glib_wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Size(Boxed<ffi::ClutterSize>);
match fn {
copy => |ptr| ffi::clutter_size_copy(mut_override(ptr)),
free => |ptr| ffi::clutter_size_free(ptr),
get_type => || ffi::clutter_size_get_type(),
}
}
impl Size {
/// Allocates a new `Size`.
///
/// # Returns
///
/// the newly allocated `Size`.
/// Use `Size::free` to free its resources.
pub fn alloc() -> Size {
unsafe { from_glib_full(ffi::clutter_size_alloc()) }
}
/// Compares two `Size` for equality.
/// ## `b`
/// a `Size` to compare
///
/// # Returns
///
/// `true` if the two `Size` are equal
pub fn equals(&self, b: &Size) -> bool {
unsafe {
from_glib(ffi::clutter_size_equals(
self.to_glib_none().0,
b.to_glib_none().0,
))
}
}
/// Initializes a `Size` with the given dimensions.
/// ## `width`
/// the width
/// ## `height`
/// the height
///
/// # Returns
///
/// the initialized `Size`
pub fn init(&mut self, width: f32, height: f32) -> Option<Size> {
unsafe {
from_glib_none(ffi::clutter_size_init(
self.to_glib_none_mut().0,
width,
height,
))
}
}
}