Skip to main content

gio/
io_module_scope.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use std::{fmt, mem, ptr};
4
5use crate::ffi;
6
7glib::wrapper! {
8    /// Represents a scope for loading IO modules. A scope can be used for blocking
9    /// duplicate modules, or blocking a module you don't want to load.
10    ///
11    /// The scope can be used with g_io_modules_load_all_in_directory_with_scope()
12    /// or g_io_modules_scan_all_in_directory_with_scope().
13    #[doc(alias = "GIOModuleScope")]
14    pub struct IOModuleScope(BoxedInline<ffi::GIOModuleScope>);
15
16    match fn {
17        copy => |ptr| {
18            let copy = glib::ffi::g_malloc0(mem::size_of::<ffi::GIOModuleScope>()) as *mut ffi::GIOModuleScope;
19            ptr::copy_nonoverlapping(ptr, copy, 1);
20            copy
21        },
22        free => |ptr| {
23            glib::ffi::g_free(ptr as *mut _);
24        },
25        init => |ptr| {
26            *ptr = mem::zeroed();
27        },
28        copy_into => |dest, src| {
29            ptr::copy_nonoverlapping(src, dest, 1);
30        },
31        clear => |ptr| {
32        },
33    }
34}
35
36impl fmt::Debug for IOModuleScope {
37    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
38        f.debug_struct("IOModuleScope").finish()
39    }
40}