summaryrefslogtreecommitdiff
path: root/rust-bindings/src/auto/bootconfig_parser.rs
blob: 0f59255fab3cdf0bc03d3d958f1f1a6b3f291b4e (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files
// DO NOT EDIT

use glib::object::IsA;
use glib::translate::*;
use std::fmt;
use std::ptr;

glib::wrapper! {
    #[doc(alias = "OstreeBootconfigParser")]
    pub struct BootconfigParser(Object<ffi::OstreeBootconfigParser>);

    match fn {
        type_ => || ffi::ostree_bootconfig_parser_get_type(),
    }
}

impl BootconfigParser {
    #[doc(alias = "ostree_bootconfig_parser_new")]
    pub fn new() -> BootconfigParser {
        unsafe {
            from_glib_full(ffi::ostree_bootconfig_parser_new())
        }
    }

    #[doc(alias = "ostree_bootconfig_parser_clone")]
#[must_use]
    pub fn clone(&self) -> BootconfigParser {
        unsafe {
            from_glib_full(ffi::ostree_bootconfig_parser_clone(self.to_glib_none().0))
        }
    }

    #[doc(alias = "ostree_bootconfig_parser_get")]
    pub fn get(&self, key: &str) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::ostree_bootconfig_parser_get(self.to_glib_none().0, key.to_glib_none().0))
        }
    }

    #[cfg(any(feature = "v2020_7", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))]
    #[doc(alias = "ostree_bootconfig_parser_get_overlay_initrds")]
    #[doc(alias = "get_overlay_initrds")]
    pub fn overlay_initrds(&self) -> Vec<glib::GString> {
        unsafe {
            FromGlibPtrContainer::from_glib_none(ffi::ostree_bootconfig_parser_get_overlay_initrds(self.to_glib_none().0))
        }
    }

    #[doc(alias = "ostree_bootconfig_parser_parse")]
    pub fn parse(&self, path: &impl IsA<gio::File>, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let is_ok = ffi::ostree_bootconfig_parser_parse(self.to_glib_none().0, path.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
            assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
        }
    }

    #[doc(alias = "ostree_bootconfig_parser_parse_at")]
    pub fn parse_at(&self, dfd: i32, path: &str, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let is_ok = ffi::ostree_bootconfig_parser_parse_at(self.to_glib_none().0, dfd, path.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
            assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
        }
    }

    #[doc(alias = "ostree_bootconfig_parser_set")]
    pub fn set(&self, key: &str, value: &str) {
        unsafe {
            ffi::ostree_bootconfig_parser_set(self.to_glib_none().0, key.to_glib_none().0, value.to_glib_none().0);
        }
    }

    #[cfg(any(feature = "v2020_7", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))]
    #[doc(alias = "ostree_bootconfig_parser_set_overlay_initrds")]
    pub fn set_overlay_initrds(&self, initrds: &[&str]) {
        unsafe {
            ffi::ostree_bootconfig_parser_set_overlay_initrds(self.to_glib_none().0, initrds.to_glib_none().0);
        }
    }

    #[doc(alias = "ostree_bootconfig_parser_write")]
    pub fn write(&self, output: &impl IsA<gio::File>, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let is_ok = ffi::ostree_bootconfig_parser_write(self.to_glib_none().0, output.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
            assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
        }
    }

    #[doc(alias = "ostree_bootconfig_parser_write_at")]
    pub fn write_at(&self, dfd: i32, path: &str, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let is_ok = ffi::ostree_bootconfig_parser_write_at(self.to_glib_none().0, dfd, path.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
            assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
        }
    }
}

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

impl fmt::Display for BootconfigParser {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str("BootconfigParser")
    }
}