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
use glib::translate::*;

glib_wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct Margin(Boxed<ffi::ClutterMargin>);

    match fn {
        copy => |ptr| ffi::clutter_margin_copy(mut_override(ptr)),
        free => |ptr| ffi::clutter_margin_free(ptr),
        get_type => || ffi::clutter_margin_get_type(),
    }
}

impl Margin {
    /// Creates a new `Margin`.
    ///
    /// # Returns
    ///
    /// a newly allocated `Margin`. Use
    ///  `Margin::free` to free the resources associated with it when
    ///  done.
    pub fn new() -> Margin {
        unsafe { from_glib_full(ffi::clutter_margin_new()) }
    }
}

#[doc(hidden)]
impl Uninitialized for Margin {
    #[inline]
    unsafe fn uninitialized() -> Self {
        Self::new()
    }
}

impl Default for Margin {
    fn default() -> Self {
        Self::new()
    }
}