animate/legacy/
knot.rs

1use glib::translate::*;
2use std::mem;
3
4glib_wrapper! {
5    #[derive(Debug, PartialOrd, Ord)] // Hash
6    pub struct Knot(Boxed<ffi::ClutterKnot>);
7
8    match fn {
9        copy => |ptr| ffi::clutter_knot_copy(mut_override(ptr)),
10        free => |ptr| ffi::clutter_knot_free(ptr),
11        get_type => || ffi::clutter_knot_get_type(),
12    }
13}
14
15impl Knot {
16    /// Compares to knot and checks if the point to the same location.
17    /// ## `knot_b`
18    /// Second knot
19    ///
20    /// # Returns
21    ///
22    /// `true` if the knots point to the same location.
23    fn equal(&self, knot_b: &Knot) -> bool {
24        unsafe {
25            from_glib(ffi::clutter_knot_equal(
26                self.to_glib_none().0,
27                knot_b.to_glib_none().0,
28            ))
29        }
30    }
31}
32
33impl PartialEq for Knot {
34    #[inline]
35    fn eq(&self, other: &Self) -> bool {
36        self.equal(other)
37    }
38}
39
40impl Eq for Knot {}
41
42#[doc(hidden)]
43impl Uninitialized for Knot {
44    #[inline]
45    unsafe fn uninitialized() -> Self {
46        mem::zeroed()
47    }
48}