glib/gobject/
type_value_table.rs

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
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::gobject_ffi;

/// The [`TypeValueTable`][crate::TypeValueTable] provides the functions required by the [`Value`][crate::Value]
/// implementation, to serve as a container for values of a type.
#[derive(Debug, Copy, Clone)]
#[doc(alias = "GTypeValueTable")]
#[repr(transparent)]
pub struct TypeValueTable(pub(crate) gobject_ffi::GTypeValueTable);

impl TypeValueTable {
    // rustdoc-stripper-ignore-next
    /// Returns a `GTypeValueTable` pointer.
    #[doc(hidden)]
    #[inline]
    pub fn as_ptr(&self) -> *mut gobject_ffi::GTypeValueTable {
        &self.0 as *const gobject_ffi::GTypeValueTable as *mut _
    }

    // rustdoc-stripper-ignore-next
    /// Borrows the underlying C value mutably.
    #[doc(hidden)]
    #[inline]
    pub unsafe fn from_glib_ptr_borrow_mut<'a>(
        ptr: *mut gobject_ffi::GTypeValueTable,
    ) -> &'a mut Self {
        &mut *(ptr as *mut Self)
    }
}

impl Default for TypeValueTable {
    // rustdoc-stripper-ignore-next
    /// Creates a new TypeValueTable with default value.
    fn default() -> Self {
        Self(gobject_ffi::GTypeValueTable {
            value_init: None,
            value_free: None,
            value_copy: None,
            value_peek_pointer: None,
            collect_format: ::std::ptr::null(),
            collect_value: None,
            lcopy_format: ::std::ptr::null(),
            lcopy_value: None,
        })
    }
}