// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use Error; use gio; use glib::GString; use glib::object::IsA; use glib::translate::*; use ostree_sys; use std::fmt; use std::ptr; glib_wrapper! { pub struct BootconfigParser(Object); match fn { get_type => || ostree_sys::ostree_bootconfig_parser_get_type(), } } impl BootconfigParser { pub fn new() -> BootconfigParser { unsafe { from_glib_full(ostree_sys::ostree_bootconfig_parser_new()) } } pub fn clone(&self) -> Option { unsafe { from_glib_full(ostree_sys::ostree_bootconfig_parser_clone(self.to_glib_none().0)) } } pub fn get(&self, key: &str) -> Option { unsafe { from_glib_none(ostree_sys::ostree_bootconfig_parser_get(self.to_glib_none().0, key.to_glib_none().0)) } } pub fn parse, Q: IsA>(&self, path: &P, cancellable: Option<&Q>) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); let _ = ostree_sys::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); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } pub fn parse_at>(&self, dfd: i32, path: &str, cancellable: Option<&P>) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); let _ = ostree_sys::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); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } pub fn set(&self, key: &str, value: &str) { unsafe { ostree_sys::ostree_bootconfig_parser_set(self.to_glib_none().0, key.to_glib_none().0, value.to_glib_none().0); } } pub fn write, Q: IsA>(&self, output: &P, cancellable: Option<&Q>) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); let _ = ostree_sys::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); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } pub fn write_at>(&self, dfd: i32, path: &str, cancellable: Option<&P>) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); let _ = ostree_sys::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); 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 { write!(f, "BootconfigParser") } }