summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca BRUNO <luca.bruno@coreos.com>2022-10-25 13:03:52 +0000
committerLuca BRUNO <luca.bruno@coreos.com>2022-10-26 13:49:35 +0000
commitdbb6daf1015d7d82ae6b8a0986706ad8b330e1ca (patch)
tree4ad64d3e711c9b8a85756e2859af3dbb161a0684
parent0b3833bf55e5557e0c22fc5cf88a7e7b237fb50c (diff)
downloadostree-dbb6daf1015d7d82ae6b8a0986706ad8b330e1ca.tar.gz
rust/ostree: regenerate for gtk-rs 0.15
-rw-r--r--Cargo.toml4
-rw-r--r--rust-bindings/conf/ostree.toml18
-rw-r--r--rust-bindings/src/auto/async_progress.rs44
-rw-r--r--rust-bindings/src/auto/bootconfig_parser.rs113
-rw-r--r--rust-bindings/src/auto/collection_ref.rs22
-rw-r--r--rust-bindings/src/auto/commit_sizes_entry.rs14
-rw-r--r--rust-bindings/src/auto/constants.rs145
-rw-r--r--rust-bindings/src/auto/content_writer.rs17
-rw-r--r--rust-bindings/src/auto/deployment.rs94
-rw-r--r--rust-bindings/src/auto/diff_item.rs1
-rw-r--r--rust-bindings/src/auto/enums.rs326
-rw-r--r--rust-bindings/src/auto/flags.rs7
-rw-r--r--rust-bindings/src/auto/functions.rs473
-rw-r--r--rust-bindings/src/auto/gpg_verify_result.rs52
-rw-r--r--rust-bindings/src/auto/mod.rs62
-rw-r--r--rust-bindings/src/auto/mutable_tree.rs170
-rw-r--r--rust-bindings/src/auto/remote.rs8
-rw-r--r--rust-bindings/src/auto/repo.rs2298
-rw-r--r--rust-bindings/src/auto/repo_commit_modifier.rs104
-rw-r--r--rust-bindings/src/auto/repo_dev_ino_cache.rs4
-rw-r--r--rust-bindings/src/auto/repo_file.rs95
-rw-r--r--rust-bindings/src/auto/repo_finder.rs12
-rw-r--r--rust-bindings/src/auto/repo_finder_avahi.rs20
-rw-r--r--rust-bindings/src/auto/repo_finder_config.rs8
-rw-r--r--rust-bindings/src/auto/repo_finder_mount.rs22
-rw-r--r--rust-bindings/src/auto/repo_finder_override.rs10
-rw-r--r--rust-bindings/src/auto/repo_finder_result.rs6
-rw-r--r--rust-bindings/src/auto/se_policy.rs135
-rw-r--r--rust-bindings/src/auto/sign.rs299
-rw-r--r--rust-bindings/src/auto/sysroot.rs652
-rw-r--r--rust-bindings/src/auto/sysroot_upgrader.rs191
-rw-r--r--rust-bindings/src/auto/versions.txt4
-rw-r--r--rust-bindings/src/repo.rs6
-rw-r--r--rust-bindings/src/repo_checkout_at_options/mod.rs2
-rw-r--r--rust-bindings/src/repo_transaction_stats.rs24
-rw-r--r--rust-bindings/src/sysroot.rs8
-rw-r--r--rust-bindings/sys/src/auto/versions.txt2
-rw-r--r--rust-bindings/tests/functions/mod.rs9
-rw-r--r--rust-bindings/tests/repo/checkout_at.rs9
-rw-r--r--rust-bindings/tests/repo/generate_static.rs3
-rw-r--r--rust-bindings/tests/repo/mod.rs27
-rw-r--r--rust-bindings/tests/sign/mod.rs4
-rw-r--r--rust-bindings/tests/util/mod.rs14
43 files changed, 4289 insertions, 1249 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 662de1cd..ddda1a88 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -41,8 +41,8 @@ bitflags = "1.2.1"
cap-std = { version = "0.25", optional = true}
io-lifetimes = { version = "0.7", optional = true}
ffi = { package = "ostree-sys", path = "rust-bindings/sys", version = "0.10.0" }
-gio = "0.14"
-glib = "0.14.4"
+gio = "0.15"
+glib = "0.15"
hex = "0.4.2"
libc = "0.2"
once_cell = "1.4.0"
diff --git a/rust-bindings/conf/ostree.toml b/rust-bindings/conf/ostree.toml
index ec2b594d..b0f0f60f 100644
--- a/rust-bindings/conf/ostree.toml
+++ b/rust-bindings/conf/ostree.toml
@@ -27,7 +27,6 @@ generate = [
"OSTree.DiffItem",
"OSTree.GpgSignatureAttr",
"OSTree.GpgSignatureFormatFlags",
- "OSTree.GpgVerifyResult",
"OSTree.MutableTree",
"OSTree.ObjectType",
"OSTree.Remote",
@@ -43,7 +42,6 @@ generate = [
"OSTree.RepoCommitState",
"OSTree.RepoDevInoCache",
"OSTree.RepoFile",
- "OSTree.RepoFinderAvahi",
"OSTree.RepoFinderConfig",
"OSTree.RepoFinderMount",
"OSTree.RepoFinderOverride",
@@ -243,6 +241,22 @@ status = "generate"
ignore = true
[[object]]
+name = "OSTree.RepoFinderAvahi"
+status = "generate"
+ [[object.function]]
+ # [FAIL] this fails because it should return a boolean, but it doesn't
+ name = "start"
+ ignore = true
+
+[[object]]
+name = "OSTree.GpgVerifyResult"
+status = "generate"
+ [[object.function]]
+ # [FAIL] these fail because of some issues with GString
+ pattern = "^describe(|_variant)$"
+ ignore = true
+
+[[object]]
name = "OSTree.*"
status = "generate"
[[object.function]]
diff --git a/rust-bindings/src/auto/async_progress.rs b/rust-bindings/src/auto/async_progress.rs
index f6040441..3f779c76 100644
--- a/rust-bindings/src/auto/async_progress.rs
+++ b/rust-bindings/src/auto/async_progress.rs
@@ -22,9 +22,7 @@ glib::wrapper! {
impl AsyncProgress {
#[doc(alias = "ostree_async_progress_new")]
pub fn new() -> AsyncProgress {
- unsafe {
- from_glib_full(ffi::ostree_async_progress_new())
- }
+ unsafe { from_glib_full(ffi::ostree_async_progress_new()) }
}
//#[doc(alias = "ostree_async_progress_new_and_connect")]
@@ -60,17 +58,13 @@ impl AsyncProgress {
#[doc(alias = "ostree_async_progress_get_status")]
#[doc(alias = "get_status")]
pub fn status(&self) -> Option<glib::GString> {
- unsafe {
- from_glib_full(ffi::ostree_async_progress_get_status(self.to_glib_none().0))
- }
+ unsafe { from_glib_full(ffi::ostree_async_progress_get_status(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_async_progress_get_uint")]
#[doc(alias = "get_uint")]
pub fn uint(&self, key: &str) -> u32 {
- unsafe {
- ffi::ostree_async_progress_get_uint(self.to_glib_none().0, key.to_glib_none().0)
- }
+ unsafe { ffi::ostree_async_progress_get_uint(self.to_glib_none().0, key.to_glib_none().0) }
}
#[doc(alias = "ostree_async_progress_get_uint64")]
@@ -87,7 +81,10 @@ impl AsyncProgress {
#[doc(alias = "get_variant")]
pub fn variant(&self, key: &str) -> Option<glib::Variant> {
unsafe {
- from_glib_full(ffi::ostree_async_progress_get_variant(self.to_glib_none().0, key.to_glib_none().0))
+ from_glib_full(ffi::ostree_async_progress_get_variant(
+ self.to_glib_none().0,
+ key.to_glib_none().0,
+ ))
}
}
@@ -117,7 +114,11 @@ impl AsyncProgress {
#[doc(alias = "ostree_async_progress_set_uint64")]
pub fn set_uint64(&self, key: &str, value: u64) {
unsafe {
- ffi::ostree_async_progress_set_uint64(self.to_glib_none().0, key.to_glib_none().0, value);
+ ffi::ostree_async_progress_set_uint64(
+ self.to_glib_none().0,
+ key.to_glib_none().0,
+ value,
+ );
}
}
@@ -126,20 +127,33 @@ impl AsyncProgress {
#[doc(alias = "ostree_async_progress_set_variant")]
pub fn set_variant(&self, key: &str, value: &glib::Variant) {
unsafe {
- ffi::ostree_async_progress_set_variant(self.to_glib_none().0, key.to_glib_none().0, value.to_glib_none().0);
+ ffi::ostree_async_progress_set_variant(
+ self.to_glib_none().0,
+ key.to_glib_none().0,
+ value.to_glib_none().0,
+ );
}
}
#[doc(alias = "changed")]
pub fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
- unsafe extern "C" fn changed_trampoline<F: Fn(&AsyncProgress) + 'static>(this: *mut ffi::OstreeAsyncProgress, f: glib::ffi::gpointer) {
+ unsafe extern "C" fn changed_trampoline<F: Fn(&AsyncProgress) + 'static>(
+ this: *mut ffi::OstreeAsyncProgress,
+ f: glib::ffi::gpointer,
+ ) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
- connect_raw(self.as_ptr() as *mut _, b"changed\0".as_ptr() as *const _,
- Some(transmute::<_, unsafe extern "C" fn()>(changed_trampoline::<F> as *const ())), Box_::into_raw(f))
+ connect_raw(
+ self.as_ptr() as *mut _,
+ b"changed\0".as_ptr() as *const _,
+ Some(transmute::<_, unsafe extern "C" fn()>(
+ changed_trampoline::<F> as *const (),
+ )),
+ Box_::into_raw(f),
+ )
}
}
}
diff --git a/rust-bindings/src/auto/bootconfig_parser.rs b/rust-bindings/src/auto/bootconfig_parser.rs
index a19a4127..2116dd56 100644
--- a/rust-bindings/src/auto/bootconfig_parser.rs
+++ b/rust-bindings/src/auto/bootconfig_parser.rs
@@ -19,22 +19,22 @@ glib::wrapper! {
impl BootconfigParser {
#[doc(alias = "ostree_bootconfig_parser_new")]
pub fn new() -> BootconfigParser {
- unsafe {
- from_glib_full(ffi::ostree_bootconfig_parser_new())
- }
+ unsafe { from_glib_full(ffi::ostree_bootconfig_parser_new()) }
}
#[doc(alias = "ostree_bootconfig_parser_clone")]
+ #[must_use]
pub fn clone(&self) -> Option<BootconfigParser> {
- unsafe {
- from_glib_full(ffi::ostree_bootconfig_parser_clone(self.to_glib_none().0))
- }
+ 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))
+ from_glib_none(ffi::ostree_bootconfig_parser_get(
+ self.to_glib_none().0,
+ key.to_glib_none().0,
+ ))
}
}
@@ -44,32 +44,68 @@ impl BootconfigParser {
#[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))
+ 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<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(&self, path: &P, cancellable: Option<&Q>) -> Result<(), glib::Error> {
+ 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 _ = 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);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ 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<P: IsA<gio::Cancellable>>(&self, dfd: i32, path: &str, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ 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 _ = 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);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ 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);
+ ffi::ostree_bootconfig_parser_set(
+ self.to_glib_none().0,
+ key.to_glib_none().0,
+ value.to_glib_none().0,
+ );
}
}
@@ -78,25 +114,58 @@ impl BootconfigParser {
#[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);
+ 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<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(&self, output: &P, cancellable: Option<&Q>) -> Result<(), glib::Error> {
+ 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 _ = 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);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ 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<P: IsA<gio::Cancellable>>(&self, dfd: i32, path: &str, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ 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 _ = 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);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ 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))
+ }
}
}
}
diff --git a/rust-bindings/src/auto/collection_ref.rs b/rust-bindings/src/auto/collection_ref.rs
index c6f8cd4c..611ec9bb 100644
--- a/rust-bindings/src/auto/collection_ref.rs
+++ b/rust-bindings/src/auto/collection_ref.rs
@@ -20,21 +20,32 @@ impl CollectionRef {
#[doc(alias = "ostree_collection_ref_new")]
pub fn new(collection_id: Option<&str>, ref_name: &str) -> Option<CollectionRef> {
unsafe {
- from_glib_full(ffi::ostree_collection_ref_new(collection_id.to_glib_none().0, ref_name.to_glib_none().0))
+ from_glib_full(ffi::ostree_collection_ref_new(
+ collection_id.to_glib_none().0,
+ ref_name.to_glib_none().0,
+ ))
}
}
#[doc(alias = "ostree_collection_ref_equal")]
fn equal(&self, ref2: &CollectionRef) -> bool {
unsafe {
- from_glib(ffi::ostree_collection_ref_equal(ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(self).0 as glib::ffi::gconstpointer, ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(ref2).0 as glib::ffi::gconstpointer))
+ from_glib(ffi::ostree_collection_ref_equal(
+ ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(self).0
+ as glib::ffi::gconstpointer,
+ ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(ref2).0
+ as glib::ffi::gconstpointer,
+ ))
}
}
#[doc(alias = "ostree_collection_ref_hash")]
fn hash(&self) -> u32 {
unsafe {
- ffi::ostree_collection_ref_hash(ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(self).0 as glib::ffi::gconstpointer)
+ ffi::ostree_collection_ref_hash(
+ ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(self).0
+ as glib::ffi::gconstpointer,
+ )
}
}
}
@@ -50,7 +61,10 @@ impl Eq for CollectionRef {}
impl hash::Hash for CollectionRef {
#[inline]
- fn hash<H>(&self, state: &mut H) where H: hash::Hasher {
+ fn hash<H>(&self, state: &mut H)
+ where
+ H: hash::Hasher,
+ {
hash::Hash::hash(&self.hash(), state)
}
}
diff --git a/rust-bindings/src/auto/commit_sizes_entry.rs b/rust-bindings/src/auto/commit_sizes_entry.rs
index c52ecc5c..ecb0c210 100644
--- a/rust-bindings/src/auto/commit_sizes_entry.rs
+++ b/rust-bindings/src/auto/commit_sizes_entry.rs
@@ -18,9 +18,19 @@ glib::wrapper! {
impl CommitSizesEntry {
#[doc(alias = "ostree_commit_sizes_entry_new")]
- pub fn new(checksum: &str, objtype: ObjectType, unpacked: u64, archived: u64) -> Option<CommitSizesEntry> {
+ pub fn new(
+ checksum: &str,
+ objtype: ObjectType,
+ unpacked: u64,
+ archived: u64,
+ ) -> Option<CommitSizesEntry> {
unsafe {
- from_glib_full(ffi::ostree_commit_sizes_entry_new(checksum.to_glib_none().0, objtype.into_glib(), unpacked, archived))
+ from_glib_full(ffi::ostree_commit_sizes_entry_new(
+ checksum.to_glib_none().0,
+ objtype.into_glib(),
+ unpacked,
+ archived,
+ ))
}
}
}
diff --git a/rust-bindings/src/auto/constants.rs b/rust-bindings/src/auto/constants.rs
index 396d5c85..768bce81 100644
--- a/rust-bindings/src/auto/constants.rs
+++ b/rust-bindings/src/auto/constants.rs
@@ -5,72 +5,175 @@
use std::ffi::CStr;
#[doc(alias = "OSTREE_COMMIT_GVARIANT_STRING")]
-pub static COMMIT_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_GVARIANT_STRING).to_str().unwrap()});
+pub static COMMIT_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_COMMIT_GVARIANT_STRING)
+ .to_str()
+ .unwrap()
+ });
#[cfg(any(feature = "v2020_4", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_4")))]
#[doc(alias = "OSTREE_COMMIT_META_KEY_ARCHITECTURE")]
-pub static COMMIT_META_KEY_ARCHITECTURE: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ARCHITECTURE).to_str().unwrap()});
+pub static COMMIT_META_KEY_ARCHITECTURE: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ARCHITECTURE)
+ .to_str()
+ .unwrap()
+ });
#[cfg(any(feature = "v2018_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
#[doc(alias = "OSTREE_COMMIT_META_KEY_COLLECTION_BINDING")]
-pub static COMMIT_META_KEY_COLLECTION_BINDING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_COLLECTION_BINDING).to_str().unwrap()});
+pub static COMMIT_META_KEY_COLLECTION_BINDING: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_COLLECTION_BINDING)
+ .to_str()
+ .unwrap()
+ });
#[cfg(any(feature = "v2017_7", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_7")))]
#[doc(alias = "OSTREE_COMMIT_META_KEY_ENDOFLIFE")]
-pub static COMMIT_META_KEY_ENDOFLIFE: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ENDOFLIFE).to_str().unwrap()});
+pub static COMMIT_META_KEY_ENDOFLIFE: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ENDOFLIFE)
+ .to_str()
+ .unwrap()
+ });
#[cfg(any(feature = "v2017_7", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_7")))]
#[doc(alias = "OSTREE_COMMIT_META_KEY_ENDOFLIFE_REBASE")]
-pub static COMMIT_META_KEY_ENDOFLIFE_REBASE: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ENDOFLIFE_REBASE).to_str().unwrap()});
+pub static COMMIT_META_KEY_ENDOFLIFE_REBASE: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ENDOFLIFE_REBASE)
+ .to_str()
+ .unwrap()
+ });
#[cfg(any(feature = "v2017_9", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_9")))]
#[doc(alias = "OSTREE_COMMIT_META_KEY_REF_BINDING")]
-pub static COMMIT_META_KEY_REF_BINDING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_REF_BINDING).to_str().unwrap()});
+pub static COMMIT_META_KEY_REF_BINDING: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_REF_BINDING)
+ .to_str()
+ .unwrap()
+ });
#[cfg(any(feature = "v2017_13", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_13")))]
#[doc(alias = "OSTREE_COMMIT_META_KEY_SOURCE_TITLE")]
-pub static COMMIT_META_KEY_SOURCE_TITLE: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_SOURCE_TITLE).to_str().unwrap()});
+pub static COMMIT_META_KEY_SOURCE_TITLE: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_SOURCE_TITLE)
+ .to_str()
+ .unwrap()
+ });
#[cfg(any(feature = "v2014_9", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2014_9")))]
#[doc(alias = "OSTREE_COMMIT_META_KEY_VERSION")]
-pub static COMMIT_META_KEY_VERSION: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_VERSION).to_str().unwrap()});
+pub static COMMIT_META_KEY_VERSION: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_VERSION)
+ .to_str()
+ .unwrap()
+ });
#[doc(alias = "OSTREE_DIRMETA_GVARIANT_STRING")]
-pub static DIRMETA_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_DIRMETA_GVARIANT_STRING).to_str().unwrap()});
+pub static DIRMETA_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_DIRMETA_GVARIANT_STRING)
+ .to_str()
+ .unwrap()
+ });
#[doc(alias = "OSTREE_FILEMETA_GVARIANT_STRING")]
-pub static FILEMETA_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_FILEMETA_GVARIANT_STRING).to_str().unwrap()});
+pub static FILEMETA_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_FILEMETA_GVARIANT_STRING)
+ .to_str()
+ .unwrap()
+ });
#[doc(alias = "OSTREE_GPG_KEY_GVARIANT_STRING")]
-pub static GPG_KEY_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_GPG_KEY_GVARIANT_STRING).to_str().unwrap()});
+pub static GPG_KEY_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_GPG_KEY_GVARIANT_STRING)
+ .to_str()
+ .unwrap()
+ });
#[cfg(any(feature = "v2021_1", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_1")))]
#[doc(alias = "OSTREE_METADATA_KEY_BOOTABLE")]
-pub static METADATA_KEY_BOOTABLE: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_METADATA_KEY_BOOTABLE).to_str().unwrap()});
+pub static METADATA_KEY_BOOTABLE: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_METADATA_KEY_BOOTABLE)
+ .to_str()
+ .unwrap()
+ });
#[cfg(any(feature = "v2021_1", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_1")))]
#[doc(alias = "OSTREE_METADATA_KEY_LINUX")]
-pub static METADATA_KEY_LINUX: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_METADATA_KEY_LINUX).to_str().unwrap()});
+pub static METADATA_KEY_LINUX: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_METADATA_KEY_LINUX)
+ .to_str()
+ .unwrap()
+ });
#[cfg(any(feature = "v2018_9", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_9")))]
#[doc(alias = "OSTREE_META_KEY_DEPLOY_COLLECTION_ID")]
-pub static META_KEY_DEPLOY_COLLECTION_ID: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_META_KEY_DEPLOY_COLLECTION_ID).to_str().unwrap()});
+pub static META_KEY_DEPLOY_COLLECTION_ID: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_META_KEY_DEPLOY_COLLECTION_ID)
+ .to_str()
+ .unwrap()
+ });
#[cfg(any(feature = "v2018_3", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_3")))]
#[doc(alias = "OSTREE_ORIGIN_TRANSIENT_GROUP")]
-pub static ORIGIN_TRANSIENT_GROUP: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_ORIGIN_TRANSIENT_GROUP).to_str().unwrap()});
+pub static ORIGIN_TRANSIENT_GROUP: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_ORIGIN_TRANSIENT_GROUP)
+ .to_str()
+ .unwrap()
+ });
#[cfg(any(feature = "v2022_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2022_2")))]
#[doc(alias = "OSTREE_PATH_BOOTED")]
-pub static PATH_BOOTED: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_PATH_BOOTED).to_str().unwrap()});
+pub static PATH_BOOTED: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_PATH_BOOTED).to_str().unwrap()
+ });
#[cfg(any(feature = "v2018_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
#[doc(alias = "OSTREE_REPO_METADATA_REF")]
-pub static REPO_METADATA_REF: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_REPO_METADATA_REF).to_str().unwrap()});
+pub static REPO_METADATA_REF: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_REPO_METADATA_REF)
+ .to_str()
+ .unwrap()
+ });
#[cfg(any(feature = "v2020_4", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_4")))]
#[doc(alias = "OSTREE_SIGN_NAME_ED25519")]
-pub static SIGN_NAME_ED25519: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_SIGN_NAME_ED25519).to_str().unwrap()});
+pub static SIGN_NAME_ED25519: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_SIGN_NAME_ED25519)
+ .to_str()
+ .unwrap()
+ });
#[doc(alias = "OSTREE_SUMMARY_GVARIANT_STRING")]
-pub static SUMMARY_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_SUMMARY_GVARIANT_STRING).to_str().unwrap()});
+pub static SUMMARY_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_SUMMARY_GVARIANT_STRING)
+ .to_str()
+ .unwrap()
+ });
#[doc(alias = "OSTREE_SUMMARY_SIG_GVARIANT_STRING")]
-pub static SUMMARY_SIG_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_SUMMARY_SIG_GVARIANT_STRING).to_str().unwrap()});
+pub static SUMMARY_SIG_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_SUMMARY_SIG_GVARIANT_STRING)
+ .to_str()
+ .unwrap()
+ });
#[doc(alias = "OSTREE_TREE_GVARIANT_STRING")]
-pub static TREE_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_TREE_GVARIANT_STRING).to_str().unwrap()});
+pub static TREE_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> =
+ once_cell::sync::Lazy::new(|| unsafe {
+ CStr::from_ptr(ffi::OSTREE_TREE_GVARIANT_STRING)
+ .to_str()
+ .unwrap()
+ });
diff --git a/rust-bindings/src/auto/content_writer.rs b/rust-bindings/src/auto/content_writer.rs
index 5631e002..86e3e847 100644
--- a/rust-bindings/src/auto/content_writer.rs
+++ b/rust-bindings/src/auto/content_writer.rs
@@ -18,11 +18,22 @@ glib::wrapper! {
impl ContentWriter {
#[doc(alias = "ostree_content_writer_finish")]
- pub fn finish<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<glib::GString, glib::Error> {
+ pub fn finish(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<glib::GString, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let ret = ffi::ostree_content_writer_finish(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ let ret = ffi::ostree_content_writer_finish(
+ self.to_glib_none().0,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
}
diff --git a/rust-bindings/src/auto/deployment.rs b/rust-bindings/src/auto/deployment.rs
index 3dddaf53..00af6cff 100644
--- a/rust-bindings/src/auto/deployment.rs
+++ b/rust-bindings/src/auto/deployment.rs
@@ -20,96 +20,100 @@ glib::wrapper! {
impl Deployment {
#[doc(alias = "ostree_deployment_new")]
- pub fn new(index: i32, osname: &str, csum: &str, deployserial: i32, bootcsum: Option<&str>, bootserial: i32) -> Deployment {
- unsafe {
- from_glib_full(ffi::ostree_deployment_new(index, osname.to_glib_none().0, csum.to_glib_none().0, deployserial, bootcsum.to_glib_none().0, bootserial))
+ pub fn new(
+ index: i32,
+ osname: &str,
+ csum: &str,
+ deployserial: i32,
+ bootcsum: Option<&str>,
+ bootserial: i32,
+ ) -> Deployment {
+ unsafe {
+ from_glib_full(ffi::ostree_deployment_new(
+ index,
+ osname.to_glib_none().0,
+ csum.to_glib_none().0,
+ deployserial,
+ bootcsum.to_glib_none().0,
+ bootserial,
+ ))
}
}
#[doc(alias = "ostree_deployment_clone")]
+ #[must_use]
pub fn clone(&self) -> Option<Deployment> {
- unsafe {
- from_glib_full(ffi::ostree_deployment_clone(self.to_glib_none().0))
- }
+ unsafe { from_glib_full(ffi::ostree_deployment_clone(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_deployment_equal")]
pub fn equal(&self, bp: &Deployment) -> bool {
unsafe {
- from_glib(ffi::ostree_deployment_equal(ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(self).0 as glib::ffi::gconstpointer, ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(bp).0 as glib::ffi::gconstpointer))
+ from_glib(ffi::ostree_deployment_equal(
+ ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(self).0
+ as glib::ffi::gconstpointer,
+ ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(bp).0
+ as glib::ffi::gconstpointer,
+ ))
}
}
#[doc(alias = "ostree_deployment_get_bootconfig")]
#[doc(alias = "get_bootconfig")]
pub fn bootconfig(&self) -> Option<BootconfigParser> {
- unsafe {
- from_glib_none(ffi::ostree_deployment_get_bootconfig(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_deployment_get_bootconfig(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_deployment_get_bootcsum")]
#[doc(alias = "get_bootcsum")]
pub fn bootcsum(&self) -> Option<glib::GString> {
- unsafe {
- from_glib_none(ffi::ostree_deployment_get_bootcsum(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_deployment_get_bootcsum(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_deployment_get_bootserial")]
#[doc(alias = "get_bootserial")]
pub fn bootserial(&self) -> i32 {
- unsafe {
- ffi::ostree_deployment_get_bootserial(self.to_glib_none().0)
- }
+ unsafe { ffi::ostree_deployment_get_bootserial(self.to_glib_none().0) }
}
#[doc(alias = "ostree_deployment_get_csum")]
#[doc(alias = "get_csum")]
pub fn csum(&self) -> Option<glib::GString> {
- unsafe {
- from_glib_none(ffi::ostree_deployment_get_csum(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_deployment_get_csum(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_deployment_get_deployserial")]
#[doc(alias = "get_deployserial")]
pub fn deployserial(&self) -> i32 {
- unsafe {
- ffi::ostree_deployment_get_deployserial(self.to_glib_none().0)
- }
+ unsafe { ffi::ostree_deployment_get_deployserial(self.to_glib_none().0) }
}
#[doc(alias = "ostree_deployment_get_index")]
#[doc(alias = "get_index")]
pub fn index(&self) -> i32 {
- unsafe {
- ffi::ostree_deployment_get_index(self.to_glib_none().0)
- }
+ unsafe { ffi::ostree_deployment_get_index(self.to_glib_none().0) }
}
#[doc(alias = "ostree_deployment_get_origin")]
#[doc(alias = "get_origin")]
pub fn origin(&self) -> Option<glib::KeyFile> {
- unsafe {
- from_glib_none(ffi::ostree_deployment_get_origin(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_deployment_get_origin(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_deployment_get_origin_relpath")]
#[doc(alias = "get_origin_relpath")]
pub fn origin_relpath(&self) -> Option<glib::GString> {
unsafe {
- from_glib_full(ffi::ostree_deployment_get_origin_relpath(self.to_glib_none().0))
+ from_glib_full(ffi::ostree_deployment_get_origin_relpath(
+ self.to_glib_none().0,
+ ))
}
}
#[doc(alias = "ostree_deployment_get_osname")]
#[doc(alias = "get_osname")]
pub fn osname(&self) -> Option<glib::GString> {
- unsafe {
- from_glib_none(ffi::ostree_deployment_get_osname(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_deployment_get_osname(self.to_glib_none().0)) }
}
#[cfg(any(feature = "v2016_4", feature = "dox"))]
@@ -117,15 +121,16 @@ impl Deployment {
#[doc(alias = "ostree_deployment_get_unlocked")]
#[doc(alias = "get_unlocked")]
pub fn unlocked(&self) -> DeploymentUnlockedState {
- unsafe {
- from_glib(ffi::ostree_deployment_get_unlocked(self.to_glib_none().0))
- }
+ unsafe { from_glib(ffi::ostree_deployment_get_unlocked(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_deployment_hash")]
pub fn hash(&self) -> u32 {
unsafe {
- ffi::ostree_deployment_hash(ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(self).0 as glib::ffi::gconstpointer)
+ ffi::ostree_deployment_hash(
+ ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(self).0
+ as glib::ffi::gconstpointer,
+ )
}
}
@@ -133,24 +138,23 @@ impl Deployment {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_3")))]
#[doc(alias = "ostree_deployment_is_pinned")]
pub fn is_pinned(&self) -> bool {
- unsafe {
- from_glib(ffi::ostree_deployment_is_pinned(self.to_glib_none().0))
- }
+ unsafe { from_glib(ffi::ostree_deployment_is_pinned(self.to_glib_none().0)) }
}
#[cfg(any(feature = "v2018_3", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_3")))]
#[doc(alias = "ostree_deployment_is_staged")]
pub fn is_staged(&self) -> bool {
- unsafe {
- from_glib(ffi::ostree_deployment_is_staged(self.to_glib_none().0))
- }
+ unsafe { from_glib(ffi::ostree_deployment_is_staged(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_deployment_set_bootconfig")]
pub fn set_bootconfig(&self, bootconfig: Option<&BootconfigParser>) {
unsafe {
- ffi::ostree_deployment_set_bootconfig(self.to_glib_none().0, bootconfig.to_glib_none().0);
+ ffi::ostree_deployment_set_bootconfig(
+ self.to_glib_none().0,
+ bootconfig.to_glib_none().0,
+ );
}
}
@@ -189,7 +193,9 @@ impl Deployment {
#[doc(alias = "ostree_deployment_unlocked_state_to_string")]
pub fn unlocked_state_to_string(state: DeploymentUnlockedState) -> Option<glib::GString> {
unsafe {
- from_glib_none(ffi::ostree_deployment_unlocked_state_to_string(state.into_glib()))
+ from_glib_none(ffi::ostree_deployment_unlocked_state_to_string(
+ state.into_glib(),
+ ))
}
}
}
diff --git a/rust-bindings/src/auto/diff_item.rs b/rust-bindings/src/auto/diff_item.rs
index 7320367f..a7330acc 100644
--- a/rust-bindings/src/auto/diff_item.rs
+++ b/rust-bindings/src/auto/diff_item.rs
@@ -2,7 +2,6 @@
// from gir-files
// DO NOT EDIT
-
glib::wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct DiffItem(Shared<ffi::OstreeDiffItem>);
diff --git a/rust-bindings/src/auto/enums.rs b/rust-bindings/src/auto/enums.rs
index 2eecdb97..573c5d98 100644
--- a/rust-bindings/src/auto/enums.rs
+++ b/rust-bindings/src/auto/enums.rs
@@ -5,8 +5,7 @@
use glib::translate::*;
use std::fmt;
-#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
-#[derive(Clone, Copy)]
+#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeDeploymentUnlockedState")]
pub enum DeploymentUnlockedState {
@@ -18,19 +17,23 @@ pub enum DeploymentUnlockedState {
Hotfix,
#[doc(alias = "OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT")]
Transient,
-#[doc(hidden)]
+ #[doc(hidden)]
__Unknown(i32),
}
impl fmt::Display for DeploymentUnlockedState {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "DeploymentUnlockedState::{}", match *self {
- Self::None => "None",
- Self::Development => "Development",
- Self::Hotfix => "Hotfix",
- Self::Transient => "Transient",
- _ => "Unknown",
- })
+ write!(
+ f,
+ "DeploymentUnlockedState::{}",
+ match *self {
+ Self::None => "None",
+ Self::Development => "Development",
+ Self::Hotfix => "Hotfix",
+ Self::Transient => "Transient",
+ _ => "Unknown",
+ }
+ )
}
}
@@ -45,7 +48,7 @@ impl IntoGlib for DeploymentUnlockedState {
Self::Hotfix => ffi::OSTREE_DEPLOYMENT_UNLOCKED_HOTFIX,
Self::Transient => ffi::OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT,
Self::__Unknown(value) => value,
-}
+ }
}
}
@@ -58,12 +61,11 @@ impl FromGlib<ffi::OstreeDeploymentUnlockedState> for DeploymentUnlockedState {
ffi::OSTREE_DEPLOYMENT_UNLOCKED_HOTFIX => Self::Hotfix,
ffi::OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT => Self::Transient,
value => Self::__Unknown(value),
-}
+ }
}
}
-#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
-#[derive(Clone, Copy)]
+#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeGpgSignatureAttr")]
pub enum GpgSignatureAttr {
@@ -97,30 +99,34 @@ pub enum GpgSignatureAttr {
KeyExpTimestamp,
#[doc(alias = "OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP_PRIMARY")]
KeyExpTimestampPrimary,
-#[doc(hidden)]
+ #[doc(hidden)]
__Unknown(i32),
}
impl fmt::Display for GpgSignatureAttr {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "GpgSignatureAttr::{}", match *self {
- Self::Valid => "Valid",
- Self::SigExpired => "SigExpired",
- Self::KeyExpired => "KeyExpired",
- Self::KeyRevoked => "KeyRevoked",
- Self::KeyMissing => "KeyMissing",
- Self::Fingerprint => "Fingerprint",
- Self::Timestamp => "Timestamp",
- Self::ExpTimestamp => "ExpTimestamp",
- Self::PubkeyAlgoName => "PubkeyAlgoName",
- Self::HashAlgoName => "HashAlgoName",
- Self::UserName => "UserName",
- Self::UserEmail => "UserEmail",
- Self::FingerprintPrimary => "FingerprintPrimary",
- Self::KeyExpTimestamp => "KeyExpTimestamp",
- Self::KeyExpTimestampPrimary => "KeyExpTimestampPrimary",
- _ => "Unknown",
- })
+ write!(
+ f,
+ "GpgSignatureAttr::{}",
+ match *self {
+ Self::Valid => "Valid",
+ Self::SigExpired => "SigExpired",
+ Self::KeyExpired => "KeyExpired",
+ Self::KeyRevoked => "KeyRevoked",
+ Self::KeyMissing => "KeyMissing",
+ Self::Fingerprint => "Fingerprint",
+ Self::Timestamp => "Timestamp",
+ Self::ExpTimestamp => "ExpTimestamp",
+ Self::PubkeyAlgoName => "PubkeyAlgoName",
+ Self::HashAlgoName => "HashAlgoName",
+ Self::UserName => "UserName",
+ Self::UserEmail => "UserEmail",
+ Self::FingerprintPrimary => "FingerprintPrimary",
+ Self::KeyExpTimestamp => "KeyExpTimestamp",
+ Self::KeyExpTimestampPrimary => "KeyExpTimestampPrimary",
+ _ => "Unknown",
+ }
+ )
}
}
@@ -144,9 +150,11 @@ impl IntoGlib for GpgSignatureAttr {
Self::UserEmail => ffi::OSTREE_GPG_SIGNATURE_ATTR_USER_EMAIL,
Self::FingerprintPrimary => ffi::OSTREE_GPG_SIGNATURE_ATTR_FINGERPRINT_PRIMARY,
Self::KeyExpTimestamp => ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP,
- Self::KeyExpTimestampPrimary => ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP_PRIMARY,
+ Self::KeyExpTimestampPrimary => {
+ ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP_PRIMARY
+ }
Self::__Unknown(value) => value,
-}
+ }
}
}
@@ -168,14 +176,15 @@ impl FromGlib<ffi::OstreeGpgSignatureAttr> for GpgSignatureAttr {
ffi::OSTREE_GPG_SIGNATURE_ATTR_USER_EMAIL => Self::UserEmail,
ffi::OSTREE_GPG_SIGNATURE_ATTR_FINGERPRINT_PRIMARY => Self::FingerprintPrimary,
ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP => Self::KeyExpTimestamp,
- ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP_PRIMARY => Self::KeyExpTimestampPrimary,
+ ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP_PRIMARY => {
+ Self::KeyExpTimestampPrimary
+ }
value => Self::__Unknown(value),
-}
+ }
}
}
-#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
-#[derive(Clone, Copy)]
+#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeObjectType")]
pub enum ObjectType {
@@ -197,24 +206,28 @@ pub enum ObjectType {
FileXattrs,
#[doc(alias = "OSTREE_OBJECT_TYPE_FILE_XATTRS_LINK")]
FileXattrsLink,
-#[doc(hidden)]
+ #[doc(hidden)]
__Unknown(i32),
}
impl fmt::Display for ObjectType {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "ObjectType::{}", match *self {
- Self::File => "File",
- Self::DirTree => "DirTree",
- Self::DirMeta => "DirMeta",
- Self::Commit => "Commit",
- Self::TombstoneCommit => "TombstoneCommit",
- Self::CommitMeta => "CommitMeta",
- Self::PayloadLink => "PayloadLink",
- Self::FileXattrs => "FileXattrs",
- Self::FileXattrsLink => "FileXattrsLink",
- _ => "Unknown",
- })
+ write!(
+ f,
+ "ObjectType::{}",
+ match *self {
+ Self::File => "File",
+ Self::DirTree => "DirTree",
+ Self::DirMeta => "DirMeta",
+ Self::Commit => "Commit",
+ Self::TombstoneCommit => "TombstoneCommit",
+ Self::CommitMeta => "CommitMeta",
+ Self::PayloadLink => "PayloadLink",
+ Self::FileXattrs => "FileXattrs",
+ Self::FileXattrsLink => "FileXattrsLink",
+ _ => "Unknown",
+ }
+ )
}
}
@@ -234,7 +247,7 @@ impl IntoGlib for ObjectType {
Self::FileXattrs => ffi::OSTREE_OBJECT_TYPE_FILE_XATTRS,
Self::FileXattrsLink => ffi::OSTREE_OBJECT_TYPE_FILE_XATTRS_LINK,
Self::__Unknown(value) => value,
-}
+ }
}
}
@@ -252,14 +265,13 @@ impl FromGlib<ffi::OstreeObjectType> for ObjectType {
ffi::OSTREE_OBJECT_TYPE_FILE_XATTRS => Self::FileXattrs,
ffi::OSTREE_OBJECT_TYPE_FILE_XATTRS_LINK => Self::FileXattrsLink,
value => Self::__Unknown(value),
-}
+ }
}
}
#[cfg(any(feature = "v2018_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_2")))]
-#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
-#[derive(Clone, Copy)]
+#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeRepoCheckoutFilterResult")]
pub enum RepoCheckoutFilterResult {
@@ -267,7 +279,7 @@ pub enum RepoCheckoutFilterResult {
Allow,
#[doc(alias = "OSTREE_REPO_CHECKOUT_FILTER_SKIP")]
Skip,
-#[doc(hidden)]
+ #[doc(hidden)]
__Unknown(i32),
}
@@ -275,11 +287,15 @@ pub enum RepoCheckoutFilterResult {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_2")))]
impl fmt::Display for RepoCheckoutFilterResult {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "RepoCheckoutFilterResult::{}", match *self {
- Self::Allow => "Allow",
- Self::Skip => "Skip",
- _ => "Unknown",
- })
+ write!(
+ f,
+ "RepoCheckoutFilterResult::{}",
+ match *self {
+ Self::Allow => "Allow",
+ Self::Skip => "Skip",
+ _ => "Unknown",
+ }
+ )
}
}
@@ -294,7 +310,7 @@ impl IntoGlib for RepoCheckoutFilterResult {
Self::Allow => ffi::OSTREE_REPO_CHECKOUT_FILTER_ALLOW,
Self::Skip => ffi::OSTREE_REPO_CHECKOUT_FILTER_SKIP,
Self::__Unknown(value) => value,
-}
+ }
}
}
@@ -307,12 +323,11 @@ impl FromGlib<ffi::OstreeRepoCheckoutFilterResult> for RepoCheckoutFilterResult
ffi::OSTREE_REPO_CHECKOUT_FILTER_ALLOW => Self::Allow,
ffi::OSTREE_REPO_CHECKOUT_FILTER_SKIP => Self::Skip,
value => Self::__Unknown(value),
-}
+ }
}
}
-#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
-#[derive(Clone, Copy)]
+#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeRepoCheckoutMode")]
pub enum RepoCheckoutMode {
@@ -320,17 +335,21 @@ pub enum RepoCheckoutMode {
None,
#[doc(alias = "OSTREE_REPO_CHECKOUT_MODE_USER")]
User,
-#[doc(hidden)]
+ #[doc(hidden)]
__Unknown(i32),
}
impl fmt::Display for RepoCheckoutMode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "RepoCheckoutMode::{}", match *self {
- Self::None => "None",
- Self::User => "User",
- _ => "Unknown",
- })
+ write!(
+ f,
+ "RepoCheckoutMode::{}",
+ match *self {
+ Self::None => "None",
+ Self::User => "User",
+ _ => "Unknown",
+ }
+ )
}
}
@@ -343,7 +362,7 @@ impl IntoGlib for RepoCheckoutMode {
Self::None => ffi::OSTREE_REPO_CHECKOUT_MODE_NONE,
Self::User => ffi::OSTREE_REPO_CHECKOUT_MODE_USER,
Self::__Unknown(value) => value,
-}
+ }
}
}
@@ -354,12 +373,11 @@ impl FromGlib<ffi::OstreeRepoCheckoutMode> for RepoCheckoutMode {
ffi::OSTREE_REPO_CHECKOUT_MODE_NONE => Self::None,
ffi::OSTREE_REPO_CHECKOUT_MODE_USER => Self::User,
value => Self::__Unknown(value),
-}
+ }
}
}
-#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
-#[derive(Clone, Copy)]
+#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeRepoCheckoutOverwriteMode")]
pub enum RepoCheckoutOverwriteMode {
@@ -371,19 +389,23 @@ pub enum RepoCheckoutOverwriteMode {
AddFiles,
#[doc(alias = "OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL")]
UnionIdentical,
-#[doc(hidden)]
+ #[doc(hidden)]
__Unknown(i32),
}
impl fmt::Display for RepoCheckoutOverwriteMode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "RepoCheckoutOverwriteMode::{}", match *self {
- Self::None => "None",
- Self::UnionFiles => "UnionFiles",
- Self::AddFiles => "AddFiles",
- Self::UnionIdentical => "UnionIdentical",
- _ => "Unknown",
- })
+ write!(
+ f,
+ "RepoCheckoutOverwriteMode::{}",
+ match *self {
+ Self::None => "None",
+ Self::UnionFiles => "UnionFiles",
+ Self::AddFiles => "AddFiles",
+ Self::UnionIdentical => "UnionIdentical",
+ _ => "Unknown",
+ }
+ )
}
}
@@ -398,7 +420,7 @@ impl IntoGlib for RepoCheckoutOverwriteMode {
Self::AddFiles => ffi::OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES,
Self::UnionIdentical => ffi::OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL,
Self::__Unknown(value) => value,
-}
+ }
}
}
@@ -411,12 +433,11 @@ impl FromGlib<ffi::OstreeRepoCheckoutOverwriteMode> for RepoCheckoutOverwriteMod
ffi::OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES => Self::AddFiles,
ffi::OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL => Self::UnionIdentical,
value => Self::__Unknown(value),
-}
+ }
}
}
-#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
-#[derive(Clone, Copy)]
+#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeRepoCommitFilterResult")]
pub enum RepoCommitFilterResult {
@@ -424,17 +445,21 @@ pub enum RepoCommitFilterResult {
Allow,
#[doc(alias = "OSTREE_REPO_COMMIT_FILTER_SKIP")]
Skip,
-#[doc(hidden)]
+ #[doc(hidden)]
__Unknown(i32),
}
impl fmt::Display for RepoCommitFilterResult {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "RepoCommitFilterResult::{}", match *self {
- Self::Allow => "Allow",
- Self::Skip => "Skip",
- _ => "Unknown",
- })
+ write!(
+ f,
+ "RepoCommitFilterResult::{}",
+ match *self {
+ Self::Allow => "Allow",
+ Self::Skip => "Skip",
+ _ => "Unknown",
+ }
+ )
}
}
@@ -447,7 +472,7 @@ impl IntoGlib for RepoCommitFilterResult {
Self::Allow => ffi::OSTREE_REPO_COMMIT_FILTER_ALLOW,
Self::Skip => ffi::OSTREE_REPO_COMMIT_FILTER_SKIP,
Self::__Unknown(value) => value,
-}
+ }
}
}
@@ -458,12 +483,11 @@ impl FromGlib<ffi::OstreeRepoCommitFilterResult> for RepoCommitFilterResult {
ffi::OSTREE_REPO_COMMIT_FILTER_ALLOW => Self::Allow,
ffi::OSTREE_REPO_COMMIT_FILTER_SKIP => Self::Skip,
value => Self::__Unknown(value),
-}
+ }
}
}
-#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
-#[derive(Clone, Copy)]
+#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeRepoCommitIterResult")]
pub enum RepoCommitIterResult {
@@ -475,19 +499,23 @@ pub enum RepoCommitIterResult {
File,
#[doc(alias = "OSTREE_REPO_COMMIT_ITER_RESULT_DIR")]
Dir,
-#[doc(hidden)]
+ #[doc(hidden)]
__Unknown(i32),
}
impl fmt::Display for RepoCommitIterResult {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "RepoCommitIterResult::{}", match *self {
- Self::Error => "Error",
- Self::End => "End",
- Self::File => "File",
- Self::Dir => "Dir",
- _ => "Unknown",
- })
+ write!(
+ f,
+ "RepoCommitIterResult::{}",
+ match *self {
+ Self::Error => "Error",
+ Self::End => "End",
+ Self::File => "File",
+ Self::Dir => "Dir",
+ _ => "Unknown",
+ }
+ )
}
}
@@ -502,7 +530,7 @@ impl IntoGlib for RepoCommitIterResult {
Self::File => ffi::OSTREE_REPO_COMMIT_ITER_RESULT_FILE,
Self::Dir => ffi::OSTREE_REPO_COMMIT_ITER_RESULT_DIR,
Self::__Unknown(value) => value,
-}
+ }
}
}
@@ -515,12 +543,11 @@ impl FromGlib<ffi::OstreeRepoCommitIterResult> for RepoCommitIterResult {
ffi::OSTREE_REPO_COMMIT_ITER_RESULT_FILE => Self::File,
ffi::OSTREE_REPO_COMMIT_ITER_RESULT_DIR => Self::Dir,
value => Self::__Unknown(value),
-}
+ }
}
}
-#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
-#[derive(Clone, Copy)]
+#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeRepoMode")]
pub enum RepoMode {
@@ -534,20 +561,24 @@ pub enum RepoMode {
BareUserOnly,
#[doc(alias = "OSTREE_REPO_MODE_BARE_SPLIT_XATTRS")]
BareSplitXattrs,
-#[doc(hidden)]
+ #[doc(hidden)]
__Unknown(i32),
}
impl fmt::Display for RepoMode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "RepoMode::{}", match *self {
- Self::Bare => "Bare",
- Self::Archive => "Archive",
- Self::BareUser => "BareUser",
- Self::BareUserOnly => "BareUserOnly",
- Self::BareSplitXattrs => "BareSplitXattrs",
- _ => "Unknown",
- })
+ write!(
+ f,
+ "RepoMode::{}",
+ match *self {
+ Self::Bare => "Bare",
+ Self::Archive => "Archive",
+ Self::BareUser => "BareUser",
+ Self::BareUserOnly => "BareUserOnly",
+ Self::BareSplitXattrs => "BareSplitXattrs",
+ _ => "Unknown",
+ }
+ )
}
}
@@ -563,7 +594,7 @@ impl IntoGlib for RepoMode {
Self::BareUserOnly => ffi::OSTREE_REPO_MODE_BARE_USER_ONLY,
Self::BareSplitXattrs => ffi::OSTREE_REPO_MODE_BARE_SPLIT_XATTRS,
Self::__Unknown(value) => value,
-}
+ }
}
}
@@ -577,12 +608,11 @@ impl FromGlib<ffi::OstreeRepoMode> for RepoMode {
ffi::OSTREE_REPO_MODE_BARE_USER_ONLY => Self::BareUserOnly,
ffi::OSTREE_REPO_MODE_BARE_SPLIT_XATTRS => Self::BareSplitXattrs,
value => Self::__Unknown(value),
-}
+ }
}
}
-#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
-#[derive(Clone, Copy)]
+#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeRepoRemoteChange")]
pub enum RepoRemoteChange {
@@ -596,20 +626,24 @@ pub enum RepoRemoteChange {
DeleteIfExists,
#[doc(alias = "OSTREE_REPO_REMOTE_CHANGE_REPLACE")]
Replace,
-#[doc(hidden)]
+ #[doc(hidden)]
__Unknown(i32),
}
impl fmt::Display for RepoRemoteChange {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "RepoRemoteChange::{}", match *self {
- Self::Add => "Add",
- Self::AddIfNotExists => "AddIfNotExists",
- Self::Delete => "Delete",
- Self::DeleteIfExists => "DeleteIfExists",
- Self::Replace => "Replace",
- _ => "Unknown",
- })
+ write!(
+ f,
+ "RepoRemoteChange::{}",
+ match *self {
+ Self::Add => "Add",
+ Self::AddIfNotExists => "AddIfNotExists",
+ Self::Delete => "Delete",
+ Self::DeleteIfExists => "DeleteIfExists",
+ Self::Replace => "Replace",
+ _ => "Unknown",
+ }
+ )
}
}
@@ -625,7 +659,7 @@ impl IntoGlib for RepoRemoteChange {
Self::DeleteIfExists => ffi::OSTREE_REPO_REMOTE_CHANGE_DELETE_IF_EXISTS,
Self::Replace => ffi::OSTREE_REPO_REMOTE_CHANGE_REPLACE,
Self::__Unknown(value) => value,
-}
+ }
}
}
@@ -639,12 +673,11 @@ impl FromGlib<ffi::OstreeRepoRemoteChange> for RepoRemoteChange {
ffi::OSTREE_REPO_REMOTE_CHANGE_DELETE_IF_EXISTS => Self::DeleteIfExists,
ffi::OSTREE_REPO_REMOTE_CHANGE_REPLACE => Self::Replace,
value => Self::__Unknown(value),
-}
+ }
}
}
-#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
-#[derive(Clone, Copy)]
+#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeStaticDeltaGenerateOpt")]
pub enum StaticDeltaGenerateOpt {
@@ -652,17 +685,21 @@ pub enum StaticDeltaGenerateOpt {
Lowlatency,
#[doc(alias = "OSTREE_STATIC_DELTA_GENERATE_OPT_MAJOR")]
Major,
-#[doc(hidden)]
+ #[doc(hidden)]
__Unknown(i32),
}
impl fmt::Display for StaticDeltaGenerateOpt {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "StaticDeltaGenerateOpt::{}", match *self {
- Self::Lowlatency => "Lowlatency",
- Self::Major => "Major",
- _ => "Unknown",
- })
+ write!(
+ f,
+ "StaticDeltaGenerateOpt::{}",
+ match *self {
+ Self::Lowlatency => "Lowlatency",
+ Self::Major => "Major",
+ _ => "Unknown",
+ }
+ )
}
}
@@ -675,7 +712,7 @@ impl IntoGlib for StaticDeltaGenerateOpt {
Self::Lowlatency => ffi::OSTREE_STATIC_DELTA_GENERATE_OPT_LOWLATENCY,
Self::Major => ffi::OSTREE_STATIC_DELTA_GENERATE_OPT_MAJOR,
Self::__Unknown(value) => value,
-}
+ }
}
}
@@ -686,7 +723,6 @@ impl FromGlib<ffi::OstreeStaticDeltaGenerateOpt> for StaticDeltaGenerateOpt {
ffi::OSTREE_STATIC_DELTA_GENERATE_OPT_LOWLATENCY => Self::Lowlatency,
ffi::OSTREE_STATIC_DELTA_GENERATE_OPT_MAJOR => Self::Major,
value => Self::__Unknown(value),
-}
+ }
}
}
-
diff --git a/rust-bindings/src/auto/flags.rs b/rust-bindings/src/auto/flags.rs
index 0a08e5f7..76ec18f2 100644
--- a/rust-bindings/src/auto/flags.rs
+++ b/rust-bindings/src/auto/flags.rs
@@ -11,8 +11,8 @@ use glib::Type;
use std::fmt;
#[cfg(any(feature = "v2017_13", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_13")))]
bitflags! {
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_13")))]
#[doc(alias = "OstreeChecksumFlags")]
pub struct ChecksumFlags: u32 {
#[doc(alias = "OSTREE_CHECKSUM_FLAGS_NONE")]
@@ -157,8 +157,8 @@ impl FromGlib<ffi::OstreeRepoCommitModifierFlags> for RepoCommitModifierFlags {
}
#[cfg(any(feature = "v2015_7", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2015_7")))]
bitflags! {
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2015_7")))]
#[doc(alias = "OstreeRepoCommitState")]
pub struct RepoCommitState: u32 {
#[doc(alias = "OSTREE_REPO_COMMIT_STATE_NORMAL")]
@@ -411,8 +411,8 @@ impl FromGlib<ffi::OstreeRepoResolveRevExtFlags> for RepoResolveRevExtFlags {
}
#[cfg(any(feature = "v2021_4", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_4")))]
bitflags! {
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_4")))]
#[doc(alias = "OstreeRepoVerifyFlags")]
pub struct RepoVerifyFlags: u32 {
#[doc(alias = "OSTREE_REPO_VERIFY_FLAGS_NONE")]
@@ -623,4 +623,3 @@ impl FromGlib<ffi::OstreeSysrootUpgraderPullFlags> for SysrootUpgraderPullFlags
Self::from_bits_truncate(value)
}
}
-
diff --git a/rust-bindings/src/auto/functions.rs b/rust-bindings/src/auto/functions.rs
index 2b5fa27d..e9be0c04 100644
--- a/rust-bindings/src/auto/functions.rs
+++ b/rust-bindings/src/auto/functions.rs
@@ -13,15 +13,30 @@ use glib::translate::*;
use std::mem;
use std::ptr;
-
#[cfg(any(feature = "v2017_15", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_15")))]
#[doc(alias = "ostree_break_hardlink")]
-pub fn break_hardlink<P: IsA<gio::Cancellable>>(dfd: i32, path: &str, skip_xattrs: bool, cancellable: Option<&P>) -> Result<(), glib::Error> {
+pub fn break_hardlink(
+ dfd: i32,
+ path: &str,
+ skip_xattrs: bool,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_break_hardlink(dfd, path.to_glib_none().0, skip_xattrs.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_break_hardlink(
+ dfd,
+ path.to_glib_none().0,
+ skip_xattrs.into_glib(),
+ 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))
+ }
}
}
@@ -29,9 +44,7 @@ pub fn break_hardlink<P: IsA<gio::Cancellable>>(dfd: i32, path: &str, skip_xattr
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_4")))]
#[doc(alias = "ostree_check_version")]
pub fn check_version(required_year: u32, required_release: u32) -> bool {
- unsafe {
- from_glib(ffi::ostree_check_version(required_year, required_release))
- }
+ unsafe { from_glib(ffi::ostree_check_version(required_year, required_release)) }
}
//#[doc(alias = "ostree_checksum_bytes_peek")]
@@ -46,16 +59,12 @@ pub fn check_version(required_year: u32, required_release: u32) -> bool {
#[doc(alias = "ostree_checksum_from_bytes_v")]
pub fn checksum_from_bytes_v(csum_v: &glib::Variant) -> Option<glib::GString> {
- unsafe {
- from_glib_full(ffi::ostree_checksum_from_bytes_v(csum_v.to_glib_none().0))
- }
+ unsafe { from_glib_full(ffi::ostree_checksum_from_bytes_v(csum_v.to_glib_none().0)) }
}
#[doc(alias = "ostree_checksum_to_bytes_v")]
pub fn checksum_to_bytes_v(checksum: &str) -> Option<glib::Variant> {
- unsafe {
- from_glib_full(ffi::ostree_checksum_to_bytes_v(checksum.to_glib_none().0))
- }
+ unsafe { from_glib_full(ffi::ostree_checksum_to_bytes_v(checksum.to_glib_none().0)) }
}
#[cfg(any(feature = "v2018_2", feature = "dox"))]
@@ -63,26 +72,41 @@ pub fn checksum_to_bytes_v(checksum: &str) -> Option<glib::Variant> {
#[doc(alias = "ostree_commit_get_content_checksum")]
pub fn commit_get_content_checksum(commit_variant: &glib::Variant) -> Option<glib::GString> {
unsafe {
- from_glib_full(ffi::ostree_commit_get_content_checksum(commit_variant.to_glib_none().0))
+ from_glib_full(ffi::ostree_commit_get_content_checksum(
+ commit_variant.to_glib_none().0,
+ ))
}
}
#[cfg(any(feature = "v2020_1", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_1")))]
#[doc(alias = "ostree_commit_get_object_sizes")]
-pub fn commit_get_object_sizes(commit_variant: &glib::Variant) -> Result<Vec<CommitSizesEntry>, glib::Error> {
+pub fn commit_get_object_sizes(
+ commit_variant: &glib::Variant,
+) -> Result<Vec<CommitSizesEntry>, glib::Error> {
unsafe {
let mut out_sizes_entries = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_commit_get_object_sizes(commit_variant.to_glib_none().0, &mut out_sizes_entries, &mut error);
- if error.is_null() { Ok(FromGlibPtrContainer::from_glib_container(out_sizes_entries)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_commit_get_object_sizes(
+ commit_variant.to_glib_none().0,
+ &mut out_sizes_entries,
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(FromGlibPtrContainer::from_glib_container(out_sizes_entries))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_commit_get_parent")]
pub fn commit_get_parent(commit_variant: &glib::Variant) -> Option<glib::GString> {
unsafe {
- from_glib_full(ffi::ostree_commit_get_parent(commit_variant.to_glib_none().0))
+ from_glib_full(ffi::ostree_commit_get_parent(
+ commit_variant.to_glib_none().0,
+ ))
}
}
@@ -90,99 +114,234 @@ pub fn commit_get_parent(commit_variant: &glib::Variant) -> Option<glib::GString
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_3")))]
#[doc(alias = "ostree_commit_get_timestamp")]
pub fn commit_get_timestamp(commit_variant: &glib::Variant) -> u64 {
- unsafe {
- ffi::ostree_commit_get_timestamp(commit_variant.to_glib_none().0)
- }
+ unsafe { ffi::ostree_commit_get_timestamp(commit_variant.to_glib_none().0) }
}
//#[cfg(any(feature = "v2021_1", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_1")))]
//#[doc(alias = "ostree_commit_metadata_for_bootable")]
-//pub fn commit_metadata_for_bootable<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(root: &P, dict: /*Ignored*/&glib::VariantDict, cancellable: Option<&Q>) -> Result<(), glib::Error> {
+//pub fn commit_metadata_for_bootable(root: &impl IsA<gio::File>, dict: /*Ignored*/&glib::VariantDict, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_commit_metadata_for_bootable() }
//}
#[doc(alias = "ostree_content_file_parse")]
-pub fn content_file_parse<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(compressed: bool, content_path: &P, trusted: bool, cancellable: Option<&Q>) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> {
+pub fn content_file_parse(
+ compressed: bool,
+ content_path: &impl IsA<gio::File>,
+ trusted: bool,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> {
unsafe {
let mut out_input = ptr::null_mut();
let mut out_file_info = ptr::null_mut();
let mut out_xattrs = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_content_file_parse(compressed.into_glib(), content_path.as_ref().to_glib_none().0, trusted.into_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok((from_glib_full(out_input), from_glib_full(out_file_info), from_glib_full(out_xattrs))) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_content_file_parse(
+ compressed.into_glib(),
+ content_path.as_ref().to_glib_none().0,
+ trusted.into_glib(),
+ &mut out_input,
+ &mut out_file_info,
+ &mut out_xattrs,
+ 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((
+ from_glib_full(out_input),
+ from_glib_full(out_file_info),
+ from_glib_full(out_xattrs),
+ ))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_content_file_parse_at")]
-pub fn content_file_parse_at<P: IsA<gio::Cancellable>>(compressed: bool, parent_dfd: i32, path: &str, trusted: bool, cancellable: Option<&P>) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> {
+pub fn content_file_parse_at(
+ compressed: bool,
+ parent_dfd: i32,
+ path: &str,
+ trusted: bool,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> {
unsafe {
let mut out_input = ptr::null_mut();
let mut out_file_info = ptr::null_mut();
let mut out_xattrs = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_content_file_parse_at(compressed.into_glib(), parent_dfd, path.to_glib_none().0, trusted.into_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok((from_glib_full(out_input), from_glib_full(out_file_info), from_glib_full(out_xattrs))) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_content_file_parse_at(
+ compressed.into_glib(),
+ parent_dfd,
+ path.to_glib_none().0,
+ trusted.into_glib(),
+ &mut out_input,
+ &mut out_file_info,
+ &mut out_xattrs,
+ 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((
+ from_glib_full(out_input),
+ from_glib_full(out_file_info),
+ from_glib_full(out_xattrs),
+ ))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_content_stream_parse")]
-pub fn content_stream_parse<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(compressed: bool, input: &P, input_length: u64, trusted: bool, cancellable: Option<&Q>) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> {
+pub fn content_stream_parse(
+ compressed: bool,
+ input: &impl IsA<gio::InputStream>,
+ input_length: u64,
+ trusted: bool,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> {
unsafe {
let mut out_input = ptr::null_mut();
let mut out_file_info = ptr::null_mut();
let mut out_xattrs = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_content_stream_parse(compressed.into_glib(), input.as_ref().to_glib_none().0, input_length, trusted.into_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok((from_glib_full(out_input), from_glib_full(out_file_info), from_glib_full(out_xattrs))) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_content_stream_parse(
+ compressed.into_glib(),
+ input.as_ref().to_glib_none().0,
+ input_length,
+ trusted.into_glib(),
+ &mut out_input,
+ &mut out_file_info,
+ &mut out_xattrs,
+ 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((
+ from_glib_full(out_input),
+ from_glib_full(out_file_info),
+ from_glib_full(out_xattrs),
+ ))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_create_directory_metadata")]
-pub fn create_directory_metadata(dir_info: &gio::FileInfo, xattrs: Option<&glib::Variant>) -> Option<glib::Variant> {
+pub fn create_directory_metadata(
+ dir_info: &gio::FileInfo,
+ xattrs: Option<&glib::Variant>,
+) -> Option<glib::Variant> {
unsafe {
- from_glib_full(ffi::ostree_create_directory_metadata(dir_info.to_glib_none().0, xattrs.to_glib_none().0))
+ from_glib_full(ffi::ostree_create_directory_metadata(
+ dir_info.to_glib_none().0,
+ xattrs.to_glib_none().0,
+ ))
}
}
#[doc(alias = "ostree_diff_dirs")]
-pub fn diff_dirs<P: IsA<gio::File>, Q: IsA<gio::File>, R: IsA<gio::Cancellable>>(flags: DiffFlags, a: &P, b: &Q, modified: &[&DiffItem], removed: &[gio::File], added: &[gio::File], cancellable: Option<&R>) -> Result<(), glib::Error> {
+pub fn diff_dirs(
+ flags: DiffFlags,
+ a: &impl IsA<gio::File>,
+ b: &impl IsA<gio::File>,
+ modified: &[&DiffItem],
+ removed: &[gio::File],
+ added: &[gio::File],
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_diff_dirs(flags.into_glib(), a.as_ref().to_glib_none().0, b.as_ref().to_glib_none().0, modified.to_glib_none().0, removed.to_glib_none().0, added.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)) }
+ let is_ok = ffi::ostree_diff_dirs(
+ flags.into_glib(),
+ a.as_ref().to_glib_none().0,
+ b.as_ref().to_glib_none().0,
+ modified.to_glib_none().0,
+ removed.to_glib_none().0,
+ added.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))
+ }
}
}
//#[cfg(any(feature = "v2017_4", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_4")))]
//#[doc(alias = "ostree_diff_dirs_with_options")]
-//pub fn diff_dirs_with_options<P: IsA<gio::File>, Q: IsA<gio::File>, R: IsA<gio::Cancellable>>(flags: DiffFlags, a: &P, b: &Q, modified: &[&DiffItem], removed: &[gio::File], added: &[gio::File], options: /*Ignored*/Option<&mut DiffDirsOptions>, cancellable: Option<&R>) -> Result<(), glib::Error> {
+//pub fn diff_dirs_with_options(flags: DiffFlags, a: &impl IsA<gio::File>, b: &impl IsA<gio::File>, modified: &[&DiffItem], removed: &[gio::File], added: &[gio::File], options: /*Ignored*/Option<&mut DiffDirsOptions>, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_diff_dirs_with_options() }
//}
#[doc(alias = "ostree_diff_print")]
-pub fn diff_print<P: IsA<gio::File>, Q: IsA<gio::File>>(a: &P, b: &Q, modified: &[&DiffItem], removed: &[gio::File], added: &[gio::File]) {
+pub fn diff_print(
+ a: &impl IsA<gio::File>,
+ b: &impl IsA<gio::File>,
+ modified: &[&DiffItem],
+ removed: &[gio::File],
+ added: &[gio::File],
+) {
unsafe {
- ffi::ostree_diff_print(a.as_ref().to_glib_none().0, b.as_ref().to_glib_none().0, modified.to_glib_none().0, removed.to_glib_none().0, added.to_glib_none().0);
+ ffi::ostree_diff_print(
+ a.as_ref().to_glib_none().0,
+ b.as_ref().to_glib_none().0,
+ modified.to_glib_none().0,
+ removed.to_glib_none().0,
+ added.to_glib_none().0,
+ );
}
}
#[doc(alias = "ostree_fs_get_all_xattrs")]
-pub fn fs_get_all_xattrs<P: IsA<gio::Cancellable>>(fd: i32, cancellable: Option<&P>) -> Result<glib::Variant, glib::Error> {
+pub fn fs_get_all_xattrs(
+ fd: i32,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+) -> Result<glib::Variant, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let ret = ffi::ostree_fs_get_all_xattrs(fd, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ let ret = ffi::ostree_fs_get_all_xattrs(
+ fd,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_fs_get_all_xattrs_at")]
-pub fn fs_get_all_xattrs_at<P: IsA<gio::Cancellable>>(dfd: i32, path: &str, cancellable: Option<&P>) -> Result<glib::Variant, glib::Error> {
+pub fn fs_get_all_xattrs_at(
+ dfd: i32,
+ path: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+) -> Result<glib::Variant, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let ret = ffi::ostree_fs_get_all_xattrs_at(dfd, path.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ let ret = ffi::ostree_fs_get_all_xattrs_at(
+ dfd,
+ path.to_glib_none().0,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -190,16 +349,12 @@ pub fn fs_get_all_xattrs_at<P: IsA<gio::Cancellable>>(dfd: i32, path: &str, canc
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))]
#[doc(alias = "ostree_gpg_error_quark")]
pub fn gpg_error_quark() -> glib::Quark {
- unsafe {
- from_glib(ffi::ostree_gpg_error_quark())
- }
+ unsafe { from_glib(ffi::ostree_gpg_error_quark()) }
}
#[doc(alias = "ostree_metadata_variant_type")]
pub fn metadata_variant_type(objtype: ObjectType) -> Option<glib::VariantType> {
- unsafe {
- from_glib_none(ffi::ostree_metadata_variant_type(objtype.into_glib()))
- }
+ unsafe { from_glib_none(ffi::ostree_metadata_variant_type(objtype.into_glib())) }
}
#[doc(alias = "ostree_object_from_string")]
@@ -207,7 +362,11 @@ pub fn object_from_string(str: &str) -> (glib::GString, ObjectType) {
unsafe {
let mut out_checksum = ptr::null_mut();
let mut out_objtype = mem::MaybeUninit::uninit();
- ffi::ostree_object_from_string(str.to_glib_none().0, &mut out_checksum, out_objtype.as_mut_ptr());
+ ffi::ostree_object_from_string(
+ str.to_glib_none().0,
+ &mut out_checksum,
+ out_objtype.as_mut_ptr(),
+ );
let out_objtype = out_objtype.assume_init();
(from_glib_full(out_checksum), from_glib(out_objtype))
}
@@ -218,7 +377,11 @@ pub fn object_name_deserialize(variant: &glib::Variant) -> (glib::GString, Objec
unsafe {
let mut out_checksum = ptr::null();
let mut out_objtype = mem::MaybeUninit::uninit();
- ffi::ostree_object_name_deserialize(variant.to_glib_none().0, &mut out_checksum, out_objtype.as_mut_ptr());
+ ffi::ostree_object_name_deserialize(
+ variant.to_glib_none().0,
+ &mut out_checksum,
+ out_objtype.as_mut_ptr(),
+ );
let out_objtype = out_objtype.assume_init();
(from_glib_none(out_checksum), from_glib(out_objtype))
}
@@ -227,29 +390,31 @@ pub fn object_name_deserialize(variant: &glib::Variant) -> (glib::GString, Objec
#[doc(alias = "ostree_object_name_serialize")]
pub fn object_name_serialize(checksum: &str, objtype: ObjectType) -> Option<glib::Variant> {
unsafe {
- from_glib_none(ffi::ostree_object_name_serialize(checksum.to_glib_none().0, objtype.into_glib()))
+ from_glib_none(ffi::ostree_object_name_serialize(
+ checksum.to_glib_none().0,
+ objtype.into_glib(),
+ ))
}
}
#[doc(alias = "ostree_object_to_string")]
pub fn object_to_string(checksum: &str, objtype: ObjectType) -> Option<glib::GString> {
unsafe {
- from_glib_full(ffi::ostree_object_to_string(checksum.to_glib_none().0, objtype.into_glib()))
+ from_glib_full(ffi::ostree_object_to_string(
+ checksum.to_glib_none().0,
+ objtype.into_glib(),
+ ))
}
}
#[doc(alias = "ostree_object_type_from_string")]
pub fn object_type_from_string(str: &str) -> ObjectType {
- unsafe {
- from_glib(ffi::ostree_object_type_from_string(str.to_glib_none().0))
- }
+ unsafe { from_glib(ffi::ostree_object_type_from_string(str.to_glib_none().0)) }
}
#[doc(alias = "ostree_object_type_to_string")]
pub fn object_type_to_string(objtype: ObjectType) -> Option<glib::GString> {
- unsafe {
- from_glib_none(ffi::ostree_object_type_to_string(objtype.into_glib()))
- }
+ unsafe { from_glib_none(ffi::ostree_object_type_to_string(objtype.into_glib())) }
}
#[doc(alias = "ostree_parse_refspec")]
@@ -258,44 +423,108 @@ pub fn parse_refspec(refspec: &str) -> Result<(Option<glib::GString>, glib::GStr
let mut out_remote = ptr::null_mut();
let mut out_ref = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_parse_refspec(refspec.to_glib_none().0, &mut out_remote, &mut out_ref, &mut error);
- if error.is_null() { Ok((from_glib_full(out_remote), from_glib_full(out_ref))) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_parse_refspec(
+ refspec.to_glib_none().0,
+ &mut out_remote,
+ &mut out_ref,
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok((from_glib_full(out_remote), from_glib_full(out_ref)))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2016_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_6")))]
#[doc(alias = "ostree_raw_file_to_archive_z2_stream")]
-pub fn raw_file_to_archive_z2_stream<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(input: &P, file_info: &gio::FileInfo, xattrs: Option<&glib::Variant>, cancellable: Option<&Q>) -> Result<gio::InputStream, glib::Error> {
+pub fn raw_file_to_archive_z2_stream(
+ input: &impl IsA<gio::InputStream>,
+ file_info: &gio::FileInfo,
+ xattrs: Option<&glib::Variant>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+) -> Result<gio::InputStream, glib::Error> {
unsafe {
let mut out_input = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_raw_file_to_archive_z2_stream(input.as_ref().to_glib_none().0, file_info.to_glib_none().0, xattrs.to_glib_none().0, &mut out_input, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_input)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_raw_file_to_archive_z2_stream(
+ input.as_ref().to_glib_none().0,
+ file_info.to_glib_none().0,
+ xattrs.to_glib_none().0,
+ &mut out_input,
+ 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(from_glib_full(out_input))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2017_3", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_3")))]
#[doc(alias = "ostree_raw_file_to_archive_z2_stream_with_options")]
-pub fn raw_file_to_archive_z2_stream_with_options<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(input: &P, file_info: &gio::FileInfo, xattrs: Option<&glib::Variant>, options: Option<&glib::Variant>, cancellable: Option<&Q>) -> Result<gio::InputStream, glib::Error> {
+pub fn raw_file_to_archive_z2_stream_with_options(
+ input: &impl IsA<gio::InputStream>,
+ file_info: &gio::FileInfo,
+ xattrs: Option<&glib::Variant>,
+ options: Option<&glib::Variant>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+) -> Result<gio::InputStream, glib::Error> {
unsafe {
let mut out_input = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_raw_file_to_archive_z2_stream_with_options(input.as_ref().to_glib_none().0, file_info.to_glib_none().0, xattrs.to_glib_none().0, options.to_glib_none().0, &mut out_input, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_input)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_raw_file_to_archive_z2_stream_with_options(
+ input.as_ref().to_glib_none().0,
+ file_info.to_glib_none().0,
+ xattrs.to_glib_none().0,
+ options.to_glib_none().0,
+ &mut out_input,
+ 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(from_glib_full(out_input))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_raw_file_to_content_stream")]
-pub fn raw_file_to_content_stream<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(input: &P, file_info: &gio::FileInfo, xattrs: Option<&glib::Variant>, cancellable: Option<&Q>) -> Result<(gio::InputStream, u64), glib::Error> {
+pub fn raw_file_to_content_stream(
+ input: &impl IsA<gio::InputStream>,
+ file_info: &gio::FileInfo,
+ xattrs: Option<&glib::Variant>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+) -> Result<(gio::InputStream, u64), glib::Error> {
unsafe {
let mut out_input = ptr::null_mut();
let mut out_length = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_raw_file_to_content_stream(input.as_ref().to_glib_none().0, file_info.to_glib_none().0, xattrs.to_glib_none().0, &mut out_input, out_length.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
+ let is_ok = ffi::ostree_raw_file_to_content_stream(
+ input.as_ref().to_glib_none().0,
+ file_info.to_glib_none().0,
+ xattrs.to_glib_none().0,
+ &mut out_input,
+ out_length.as_mut_ptr(),
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
let out_length = out_length.assume_init();
- if error.is_null() { Ok((from_glib_full(out_input), out_length)) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok((from_glib_full(out_input), out_length))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -303,8 +532,13 @@ pub fn raw_file_to_content_stream<P: IsA<gio::InputStream>, Q: IsA<gio::Cancella
pub fn validate_checksum_string(sha256: &str) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_validate_checksum_string(sha256.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_validate_checksum_string(sha256.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))
+ }
}
}
@@ -314,8 +548,13 @@ pub fn validate_checksum_string(sha256: &str) -> Result<(), glib::Error> {
pub fn validate_collection_id(collection_id: Option<&str>) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_validate_collection_id(collection_id.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_validate_collection_id(collection_id.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))
+ }
}
}
@@ -325,8 +564,13 @@ pub fn validate_collection_id(collection_id: Option<&str>) -> Result<(), glib::E
pub fn validate_remote_name(remote_name: &str) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_validate_remote_name(remote_name.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_validate_remote_name(remote_name.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))
+ }
}
}
@@ -334,8 +578,13 @@ pub fn validate_remote_name(remote_name: &str) -> Result<(), glib::Error> {
pub fn validate_rev(rev: &str) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_validate_rev(rev.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_validate_rev(rev.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))
+ }
}
}
@@ -343,8 +592,14 @@ pub fn validate_rev(rev: &str) -> Result<(), glib::Error> {
pub fn validate_structureof_checksum_string(checksum: &str) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_validate_structureof_checksum_string(checksum.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok =
+ ffi::ostree_validate_structureof_checksum_string(checksum.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))
+ }
}
}
@@ -352,8 +607,13 @@ pub fn validate_structureof_checksum_string(checksum: &str) -> Result<(), glib::
pub fn validate_structureof_commit(commit: &glib::Variant) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_validate_structureof_commit(commit.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_validate_structureof_commit(commit.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))
+ }
}
}
@@ -361,8 +621,13 @@ pub fn validate_structureof_commit(commit: &glib::Variant) -> Result<(), glib::E
pub fn validate_structureof_csum_v(checksum: &glib::Variant) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_validate_structureof_csum_v(checksum.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_validate_structureof_csum_v(checksum.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))
+ }
}
}
@@ -370,8 +635,13 @@ pub fn validate_structureof_csum_v(checksum: &glib::Variant) -> Result<(), glib:
pub fn validate_structureof_dirmeta(dirmeta: &glib::Variant) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_validate_structureof_dirmeta(dirmeta.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_validate_structureof_dirmeta(dirmeta.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))
+ }
}
}
@@ -379,8 +649,13 @@ pub fn validate_structureof_dirmeta(dirmeta: &glib::Variant) -> Result<(), glib:
pub fn validate_structureof_dirtree(dirtree: &glib::Variant) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_validate_structureof_dirtree(dirtree.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_validate_structureof_dirtree(dirtree.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))
+ }
}
}
@@ -388,8 +663,13 @@ pub fn validate_structureof_dirtree(dirtree: &glib::Variant) -> Result<(), glib:
pub fn validate_structureof_file_mode(mode: u32) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_validate_structureof_file_mode(mode, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_validate_structureof_file_mode(mode, &mut error);
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(())
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -397,7 +677,12 @@ pub fn validate_structureof_file_mode(mode: u32) -> Result<(), glib::Error> {
pub fn validate_structureof_objtype(objtype: u8) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_validate_structureof_objtype(objtype, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_validate_structureof_objtype(objtype, &mut error);
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(())
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
diff --git a/rust-bindings/src/auto/gpg_verify_result.rs b/rust-bindings/src/auto/gpg_verify_result.rs
index 3986b375..9eb16494 100644
--- a/rust-bindings/src/auto/gpg_verify_result.rs
+++ b/rust-bindings/src/auto/gpg_verify_result.rs
@@ -2,7 +2,6 @@
// from gir-files
// DO NOT EDIT
-use crate::GpgSignatureFormatFlags;
use glib::translate::*;
use std::fmt;
use std::mem;
@@ -22,23 +21,12 @@ glib::wrapper! {
impl GpgVerifyResult {
#[doc(alias = "ostree_gpg_verify_result_count_all")]
pub fn count_all(&self) -> u32 {
- unsafe {
- ffi::ostree_gpg_verify_result_count_all(self.to_glib_none().0)
- }
+ unsafe { ffi::ostree_gpg_verify_result_count_all(self.to_glib_none().0) }
}
#[doc(alias = "ostree_gpg_verify_result_count_valid")]
pub fn count_valid(&self) -> u32 {
- unsafe {
- ffi::ostree_gpg_verify_result_count_valid(self.to_glib_none().0)
- }
- }
-
- #[doc(alias = "ostree_gpg_verify_result_describe")]
- pub fn describe(&self, signature_index: u32, output_buffer: &mut glib::String, line_prefix: Option<&str>, flags: GpgSignatureFormatFlags) {
- unsafe {
- ffi::ostree_gpg_verify_result_describe(self.to_glib_none().0, signature_index, output_buffer.to_glib_none_mut().0, line_prefix.to_glib_none().0, flags.into_glib());
- }
+ unsafe { ffi::ostree_gpg_verify_result_count_valid(self.to_glib_none().0) }
}
//#[doc(alias = "ostree_gpg_verify_result_get")]
@@ -50,7 +38,10 @@ impl GpgVerifyResult {
#[doc(alias = "get_all")]
pub fn all(&self, signature_index: u32) -> Option<glib::Variant> {
unsafe {
- from_glib_none(ffi::ostree_gpg_verify_result_get_all(self.to_glib_none().0, signature_index))
+ from_glib_none(ffi::ostree_gpg_verify_result_get_all(
+ self.to_glib_none().0,
+ signature_index,
+ ))
}
}
@@ -58,9 +49,17 @@ impl GpgVerifyResult {
pub fn lookup(&self, key_id: &str) -> Option<u32> {
unsafe {
let mut out_signature_index = mem::MaybeUninit::uninit();
- let ret = from_glib(ffi::ostree_gpg_verify_result_lookup(self.to_glib_none().0, key_id.to_glib_none().0, out_signature_index.as_mut_ptr()));
+ let ret = from_glib(ffi::ostree_gpg_verify_result_lookup(
+ self.to_glib_none().0,
+ key_id.to_glib_none().0,
+ out_signature_index.as_mut_ptr(),
+ ));
let out_signature_index = out_signature_index.assume_init();
- if ret { Some(out_signature_index) } else { None }
+ if ret {
+ Some(out_signature_index)
+ } else {
+ None
+ }
}
}
@@ -70,15 +69,16 @@ impl GpgVerifyResult {
pub fn require_valid_signature(&self) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_gpg_verify_result_require_valid_signature(self.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
- }
- }
-
- #[doc(alias = "ostree_gpg_verify_result_describe_variant")]
- pub fn describe_variant(variant: &glib::Variant, output_buffer: &mut glib::String, line_prefix: Option<&str>, flags: GpgSignatureFormatFlags) {
- unsafe {
- ffi::ostree_gpg_verify_result_describe_variant(variant.to_glib_none().0, output_buffer.to_glib_none_mut().0, line_prefix.to_glib_none().0, flags.into_glib());
+ let is_ok = ffi::ostree_gpg_verify_result_require_valid_signature(
+ self.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))
+ }
}
}
}
diff --git a/rust-bindings/src/auto/mod.rs b/rust-bindings/src/auto/mod.rs
index c6618214..39b6448c 100644
--- a/rust-bindings/src/auto/mod.rs
+++ b/rust-bindings/src/auto/mod.rs
@@ -3,79 +3,55 @@
// DO NOT EDIT
mod async_progress;
-pub use self::async_progress::{AsyncProgress};
+pub use self::async_progress::AsyncProgress;
mod bootconfig_parser;
-pub use self::bootconfig_parser::{BootconfigParser};
+pub use self::bootconfig_parser::BootconfigParser;
mod content_writer;
-pub use self::content_writer::{ContentWriter};
+pub use self::content_writer::ContentWriter;
mod deployment;
-pub use self::deployment::{Deployment};
+pub use self::deployment::Deployment;
mod gpg_verify_result;
-pub use self::gpg_verify_result::{GpgVerifyResult};
+pub use self::gpg_verify_result::GpgVerifyResult;
mod mutable_tree;
-pub use self::mutable_tree::{MutableTree};
+pub use self::mutable_tree::MutableTree;
mod repo;
-pub use self::repo::{Repo};
+pub use self::repo::Repo;
mod repo_file;
-pub use self::repo_file::{RepoFile};
+pub use self::repo_file::RepoFile;
-#[cfg(any(feature = "v2018_6", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
mod repo_finder;
-#[cfg(any(feature = "v2018_6", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
-pub use self::repo_finder::{RepoFinder, NONE_REPO_FINDER};
+pub use self::repo_finder::RepoFinder;
-#[cfg(any(feature = "v2018_6", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
mod repo_finder_avahi;
-#[cfg(any(feature = "v2018_6", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
-pub use self::repo_finder_avahi::{RepoFinderAvahi};
+pub use self::repo_finder_avahi::RepoFinderAvahi;
-#[cfg(any(feature = "v2018_6", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
mod repo_finder_config;
-#[cfg(any(feature = "v2018_6", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
-pub use self::repo_finder_config::{RepoFinderConfig};
+pub use self::repo_finder_config::RepoFinderConfig;
-#[cfg(any(feature = "v2018_6", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
mod repo_finder_mount;
-#[cfg(any(feature = "v2018_6", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
-pub use self::repo_finder_mount::{RepoFinderMount};
+pub use self::repo_finder_mount::RepoFinderMount;
-#[cfg(any(feature = "v2018_6", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
mod repo_finder_override;
-#[cfg(any(feature = "v2018_6", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
-pub use self::repo_finder_override::{RepoFinderOverride};
+pub use self::repo_finder_override::RepoFinderOverride;
mod se_policy;
-pub use self::se_policy::{SePolicy};
+pub use self::se_policy::SePolicy;
-#[cfg(any(feature = "v2020_2", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
mod sign;
-#[cfg(any(feature = "v2020_2", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
-pub use self::sign::{Sign, NONE_SIGN};
+pub use self::sign::Sign;
mod sysroot;
-pub use self::sysroot::{Sysroot};
+pub use self::sysroot::Sysroot;
mod sysroot_upgrader;
-pub use self::sysroot_upgrader::{SysrootUpgrader};
+pub use self::sysroot_upgrader::SysrootUpgrader;
#[cfg(any(feature = "v2018_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
@@ -208,10 +184,6 @@ pub use self::constants::TREE_GVARIANT_STRING;
#[doc(hidden)]
pub mod traits {
- #[cfg(any(feature = "v2018_6", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
pub use super::repo_finder::RepoFinderExt;
- #[cfg(any(feature = "v2020_2", feature = "dox"))]
-#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
pub use super::sign::SignExt;
}
diff --git a/rust-bindings/src/auto/mutable_tree.rs b/rust-bindings/src/auto/mutable_tree.rs
index 1b581fb8..9322775f 100644
--- a/rust-bindings/src/auto/mutable_tree.rs
+++ b/rust-bindings/src/auto/mutable_tree.rs
@@ -21,18 +21,24 @@ glib::wrapper! {
impl MutableTree {
#[doc(alias = "ostree_mutable_tree_new")]
pub fn new() -> MutableTree {
- unsafe {
- from_glib_full(ffi::ostree_mutable_tree_new())
- }
+ unsafe { from_glib_full(ffi::ostree_mutable_tree_new()) }
}
#[cfg(any(feature = "v2018_7", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_7")))]
#[doc(alias = "ostree_mutable_tree_new_from_checksum")]
#[doc(alias = "new_from_checksum")]
- pub fn from_checksum(repo: &Repo, contents_checksum: &str, metadata_checksum: &str) -> MutableTree {
+ pub fn from_checksum(
+ repo: &Repo,
+ contents_checksum: &str,
+ metadata_checksum: &str,
+ ) -> MutableTree {
unsafe {
- from_glib_full(ffi::ostree_mutable_tree_new_from_checksum(repo.to_glib_none().0, contents_checksum.to_glib_none().0, metadata_checksum.to_glib_none().0))
+ from_glib_full(ffi::ostree_mutable_tree_new_from_checksum(
+ repo.to_glib_none().0,
+ contents_checksum.to_glib_none().0,
+ metadata_checksum.to_glib_none().0,
+ ))
}
}
@@ -43,8 +49,16 @@ impl MutableTree {
pub fn from_commit(repo: &Repo, rev: &str) -> Result<MutableTree, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let ret = ffi::ostree_mutable_tree_new_from_commit(repo.to_glib_none().0, rev.to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ let ret = ffi::ostree_mutable_tree_new_from_commit(
+ repo.to_glib_none().0,
+ rev.to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -54,8 +68,13 @@ impl MutableTree {
pub fn check_error(&self) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_mutable_tree_check_error(self.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_mutable_tree_check_error(self.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))
+ }
}
}
@@ -64,27 +83,62 @@ impl MutableTree {
unsafe {
let mut out_subdir = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_mutable_tree_ensure_dir(self.to_glib_none().0, name.to_glib_none().0, &mut out_subdir, &mut error);
- if error.is_null() { Ok(from_glib_full(out_subdir)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_mutable_tree_ensure_dir(
+ self.to_glib_none().0,
+ name.to_glib_none().0,
+ &mut out_subdir,
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib_full(out_subdir))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_mutable_tree_ensure_parent_dirs")]
- pub fn ensure_parent_dirs(&self, split_path: &[&str], metadata_checksum: &str) -> Result<MutableTree, glib::Error> {
+ pub fn ensure_parent_dirs(
+ &self,
+ split_path: &[&str],
+ metadata_checksum: &str,
+ ) -> Result<MutableTree, glib::Error> {
unsafe {
let mut out_parent = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_mutable_tree_ensure_parent_dirs(self.to_glib_none().0, split_path.to_glib_none().0, metadata_checksum.to_glib_none().0, &mut out_parent, &mut error);
- if error.is_null() { Ok(from_glib_full(out_parent)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_mutable_tree_ensure_parent_dirs(
+ self.to_glib_none().0,
+ split_path.to_glib_none().0,
+ metadata_checksum.to_glib_none().0,
+ &mut out_parent,
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib_full(out_parent))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2018_7", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_7")))]
#[doc(alias = "ostree_mutable_tree_fill_empty_from_dirtree")]
- pub fn fill_empty_from_dirtree(&self, repo: &Repo, contents_checksum: &str, metadata_checksum: &str) -> bool {
+ pub fn fill_empty_from_dirtree(
+ &self,
+ repo: &Repo,
+ contents_checksum: &str,
+ metadata_checksum: &str,
+ ) -> bool {
unsafe {
- from_glib(ffi::ostree_mutable_tree_fill_empty_from_dirtree(self.to_glib_none().0, repo.to_glib_none().0, contents_checksum.to_glib_none().0, metadata_checksum.to_glib_none().0))
+ from_glib(ffi::ostree_mutable_tree_fill_empty_from_dirtree(
+ self.to_glib_none().0,
+ repo.to_glib_none().0,
+ contents_checksum.to_glib_none().0,
+ metadata_checksum.to_glib_none().0,
+ ))
}
}
@@ -92,7 +146,9 @@ impl MutableTree {
#[doc(alias = "get_contents_checksum")]
pub fn contents_checksum(&self) -> Option<glib::GString> {
unsafe {
- from_glib_none(ffi::ostree_mutable_tree_get_contents_checksum(self.to_glib_none().0))
+ from_glib_none(ffi::ostree_mutable_tree_get_contents_checksum(
+ self.to_glib_none().0,
+ ))
}
}
@@ -106,7 +162,9 @@ impl MutableTree {
#[doc(alias = "get_metadata_checksum")]
pub fn metadata_checksum(&self) -> Option<glib::GString> {
unsafe {
- from_glib_none(ffi::ostree_mutable_tree_get_metadata_checksum(self.to_glib_none().0))
+ from_glib_none(ffi::ostree_mutable_tree_get_metadata_checksum(
+ self.to_glib_none().0,
+ ))
}
}
@@ -117,13 +175,30 @@ impl MutableTree {
//}
#[doc(alias = "ostree_mutable_tree_lookup")]
- pub fn lookup(&self, name: &str) -> Result<(Option<glib::GString>, Option<MutableTree>), glib::Error> {
+ pub fn lookup(
+ &self,
+ name: &str,
+ ) -> Result<(Option<glib::GString>, Option<MutableTree>), glib::Error> {
unsafe {
let mut out_file_checksum = ptr::null_mut();
let mut out_subdir = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_mutable_tree_lookup(self.to_glib_none().0, name.to_glib_none().0, &mut out_file_checksum, &mut out_subdir, &mut error);
- if error.is_null() { Ok((from_glib_full(out_file_checksum), from_glib_full(out_subdir))) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_mutable_tree_lookup(
+ self.to_glib_none().0,
+ name.to_glib_none().0,
+ &mut out_file_checksum,
+ &mut out_subdir,
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok((
+ from_glib_full(out_file_checksum),
+ from_glib_full(out_subdir),
+ ))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -133,8 +208,18 @@ impl MutableTree {
pub fn remove(&self, name: &str, allow_noent: bool) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_mutable_tree_remove(self.to_glib_none().0, name.to_glib_none().0, allow_noent.into_glib(), &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_mutable_tree_remove(
+ self.to_glib_none().0,
+ name.to_glib_none().0,
+ allow_noent.into_glib(),
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(())
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -142,22 +227,38 @@ impl MutableTree {
pub fn replace_file(&self, name: &str, checksum: &str) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_mutable_tree_replace_file(self.to_glib_none().0, name.to_glib_none().0, checksum.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_mutable_tree_replace_file(
+ self.to_glib_none().0,
+ name.to_glib_none().0,
+ checksum.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_mutable_tree_set_contents_checksum")]
pub fn set_contents_checksum(&self, checksum: &str) {
unsafe {
- ffi::ostree_mutable_tree_set_contents_checksum(self.to_glib_none().0, checksum.to_glib_none().0);
+ ffi::ostree_mutable_tree_set_contents_checksum(
+ self.to_glib_none().0,
+ checksum.to_glib_none().0,
+ );
}
}
#[doc(alias = "ostree_mutable_tree_set_metadata_checksum")]
pub fn set_metadata_checksum(&self, checksum: &str) {
unsafe {
- ffi::ostree_mutable_tree_set_metadata_checksum(self.to_glib_none().0, checksum.to_glib_none().0);
+ ffi::ostree_mutable_tree_set_metadata_checksum(
+ self.to_glib_none().0,
+ checksum.to_glib_none().0,
+ );
}
}
@@ -166,8 +267,19 @@ impl MutableTree {
unsafe {
let mut out_subdir = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_mutable_tree_walk(self.to_glib_none().0, split_path.to_glib_none().0, start, &mut out_subdir, &mut error);
- if error.is_null() { Ok(from_glib_full(out_subdir)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_mutable_tree_walk(
+ self.to_glib_none().0,
+ split_path.to_glib_none().0,
+ start,
+ &mut out_subdir,
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib_full(out_subdir))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
}
diff --git a/rust-bindings/src/auto/remote.rs b/rust-bindings/src/auto/remote.rs
index 95939f25..f9b1698d 100644
--- a/rust-bindings/src/auto/remote.rs
+++ b/rust-bindings/src/auto/remote.rs
@@ -19,16 +19,12 @@ impl Remote {
#[doc(alias = "ostree_remote_get_name")]
#[doc(alias = "get_name")]
pub fn name(&self) -> Option<glib::GString> {
- unsafe {
- from_glib_none(ffi::ostree_remote_get_name(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_remote_get_name(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_remote_get_url")]
#[doc(alias = "get_url")]
pub fn url(&self) -> Option<glib::GString> {
- unsafe {
- from_glib_full(ffi::ostree_remote_get_url(self.to_glib_none().0))
- }
+ unsafe { from_glib_full(ffi::ostree_remote_get_url(self.to_glib_none().0)) }
}
}
diff --git a/rust-bindings/src/auto/repo.rs b/rust-bindings/src/auto/repo.rs
index 56a39c16..7864f2f6 100644
--- a/rust-bindings/src/auto/repo.rs
+++ b/rust-bindings/src/auto/repo.rs
@@ -66,115 +66,256 @@ glib::wrapper! {
impl Repo {
#[doc(alias = "ostree_repo_new")]
- pub fn new<P: IsA<gio::File>>(path: &P) -> Repo {
- unsafe {
- from_glib_full(ffi::ostree_repo_new(path.as_ref().to_glib_none().0))
- }
+ pub fn new(path: &impl IsA<gio::File>) -> Repo {
+ unsafe { from_glib_full(ffi::ostree_repo_new(path.as_ref().to_glib_none().0)) }
}
#[doc(alias = "ostree_repo_new_default")]
pub fn new_default() -> Repo {
- unsafe {
- from_glib_full(ffi::ostree_repo_new_default())
- }
+ unsafe { from_glib_full(ffi::ostree_repo_new_default()) }
}
#[doc(alias = "ostree_repo_new_for_sysroot_path")]
#[doc(alias = "new_for_sysroot_path")]
- pub fn for_sysroot_path<P: IsA<gio::File>, Q: IsA<gio::File>>(repo_path: &P, sysroot_path: &Q) -> Repo {
+ pub fn for_sysroot_path(
+ repo_path: &impl IsA<gio::File>,
+ sysroot_path: &impl IsA<gio::File>,
+ ) -> Repo {
unsafe {
- from_glib_full(ffi::ostree_repo_new_for_sysroot_path(repo_path.as_ref().to_glib_none().0, sysroot_path.as_ref().to_glib_none().0))
+ from_glib_full(ffi::ostree_repo_new_for_sysroot_path(
+ repo_path.as_ref().to_glib_none().0,
+ sysroot_path.as_ref().to_glib_none().0,
+ ))
}
}
#[doc(alias = "ostree_repo_abort_transaction")]
- pub fn abort_transaction<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn abort_transaction(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_abort_transaction(self.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)) }
+ let is_ok = ffi::ostree_repo_abort_transaction(
+ self.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_repo_add_gpg_signature_summary")]
- pub fn add_gpg_signature_summary<P: IsA<gio::Cancellable>>(&self, key_id: &[&str], homedir: Option<&str>, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_add_gpg_signature_summary(self.to_glib_none().0, key_id.to_glib_none().0, homedir.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 add_gpg_signature_summary(
+ &self,
+ key_id: &[&str],
+ homedir: Option<&str>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_add_gpg_signature_summary(
+ self.to_glib_none().0,
+ key_id.to_glib_none().0,
+ homedir.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_repo_append_gpg_signature")]
- pub fn append_gpg_signature<P: IsA<gio::Cancellable>>(&self, commit_checksum: &str, signature_bytes: &glib::Bytes, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_append_gpg_signature(self.to_glib_none().0, commit_checksum.to_glib_none().0, signature_bytes.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 append_gpg_signature(
+ &self,
+ commit_checksum: &str,
+ signature_bytes: &glib::Bytes,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_append_gpg_signature(
+ self.to_glib_none().0,
+ commit_checksum.to_glib_none().0,
+ signature_bytes.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))
+ }
}
}
#[cfg(any(feature = "v2016_8", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_8")))]
#[doc(alias = "ostree_repo_checkout_at")]
- pub fn checkout_at<P: AsRef<std::path::Path>, Q: IsA<gio::Cancellable>>(&self, options: Option<&RepoCheckoutAtOptions>, destination_dfd: i32, destination_path: P, commit: &str, cancellable: Option<&Q>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_checkout_at(self.to_glib_none().0, mut_override(options.to_glib_none().0), destination_dfd, destination_path.as_ref().to_glib_none().0, commit.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 checkout_at(
+ &self,
+ options: Option<&RepoCheckoutAtOptions>,
+ destination_dfd: i32,
+ destination_path: impl AsRef<std::path::Path>,
+ commit: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_checkout_at(
+ self.to_glib_none().0,
+ mut_override(options.to_glib_none().0),
+ destination_dfd,
+ destination_path.as_ref().to_glib_none().0,
+ commit.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_repo_checkout_gc")]
- pub fn checkout_gc<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn checkout_gc(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_checkout_gc(self.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)) }
+ let is_ok = ffi::ostree_repo_checkout_gc(
+ self.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_repo_checkout_tree")]
- pub fn checkout_tree<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(&self, mode: RepoCheckoutMode, overwrite_mode: RepoCheckoutOverwriteMode, destination: &P, source: &RepoFile, source_info: &gio::FileInfo, cancellable: Option<&Q>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_checkout_tree(self.to_glib_none().0, mode.into_glib(), overwrite_mode.into_glib(), destination.as_ref().to_glib_none().0, source.to_glib_none().0, source_info.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 checkout_tree(
+ &self,
+ mode: RepoCheckoutMode,
+ overwrite_mode: RepoCheckoutOverwriteMode,
+ destination: &impl IsA<gio::File>,
+ source: &RepoFile,
+ source_info: &gio::FileInfo,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_checkout_tree(
+ self.to_glib_none().0,
+ mode.into_glib(),
+ overwrite_mode.into_glib(),
+ destination.as_ref().to_glib_none().0,
+ source.to_glib_none().0,
+ source_info.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_repo_commit_transaction")]
- pub fn commit_transaction<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<RepoTransactionStats, glib::Error> {
+ pub fn commit_transaction(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<RepoTransactionStats, glib::Error> {
unsafe {
let mut out_stats = RepoTransactionStats::uninitialized();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_commit_transaction(self.to_glib_none().0, out_stats.to_glib_none_mut().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(out_stats) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_commit_transaction(
+ self.to_glib_none().0,
+ out_stats.to_glib_none_mut().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(out_stats)
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_copy_config")]
pub fn copy_config(&self) -> Option<glib::KeyFile> {
- unsafe {
- from_glib_full(ffi::ostree_repo_copy_config(self.to_glib_none().0))
- }
+ unsafe { from_glib_full(ffi::ostree_repo_copy_config(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_repo_create")]
- pub fn create<P: IsA<gio::Cancellable>>(&self, mode: RepoMode, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn create(
+ &self,
+ mode: RepoMode,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_create(self.to_glib_none().0, mode.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_create(
+ self.to_glib_none().0,
+ mode.into_glib(),
+ 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_repo_delete_object")]
- pub fn delete_object<P: IsA<gio::Cancellable>>(&self, objtype: ObjectType, sha256: &str, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_delete_object(self.to_glib_none().0, objtype.into_glib(), sha256.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 delete_object(
+ &self,
+ objtype: ObjectType,
+ sha256: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_delete_object(
+ self.to_glib_none().0,
+ objtype.into_glib(),
+ sha256.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))
+ }
}
}
@@ -183,23 +324,42 @@ impl Repo {
#[doc(alias = "ostree_repo_equal")]
pub fn equal(&self, b: &Repo) -> bool {
unsafe {
- from_glib(ffi::ostree_repo_equal(self.to_glib_none().0, b.to_glib_none().0))
+ from_glib(ffi::ostree_repo_equal(
+ self.to_glib_none().0,
+ b.to_glib_none().0,
+ ))
}
}
//#[doc(alias = "ostree_repo_export_tree_to_archive")]
- //pub fn export_tree_to_archive<P: IsA<gio::Cancellable>>(&self, opts: /*Ignored*/&mut RepoExportArchiveOptions, root: &RepoFile, archive: /*Unimplemented*/Option<Fundamental: Pointer>, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ //pub fn export_tree_to_archive(&self, opts: /*Ignored*/&mut RepoExportArchiveOptions, root: &RepoFile, archive: /*Unimplemented*/Option<Fundamental: Pointer>, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_export_tree_to_archive() }
//}
#[cfg(any(feature = "v2017_15", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_15")))]
#[doc(alias = "ostree_repo_fsck_object")]
- pub fn fsck_object<P: IsA<gio::Cancellable>>(&self, objtype: ObjectType, sha256: &str, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_fsck_object(self.to_glib_none().0, objtype.into_glib(), sha256.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 fsck_object(
+ &self,
+ objtype: ObjectType,
+ sha256: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_fsck_object(
+ self.to_glib_none().0,
+ objtype.into_glib(),
+ sha256.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))
+ }
}
}
@@ -208,9 +368,7 @@ impl Repo {
#[doc(alias = "ostree_repo_get_bootloader")]
#[doc(alias = "get_bootloader")]
pub fn bootloader(&self) -> Option<glib::GString> {
- unsafe {
- from_glib_none(ffi::ostree_repo_get_bootloader(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_repo_get_bootloader(self.to_glib_none().0)) }
}
#[cfg(any(feature = "v2018_6", feature = "dox"))]
@@ -218,17 +376,13 @@ impl Repo {
#[doc(alias = "ostree_repo_get_collection_id")]
#[doc(alias = "get_collection_id")]
pub fn collection_id(&self) -> Option<glib::GString> {
- unsafe {
- from_glib_none(ffi::ostree_repo_get_collection_id(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_repo_get_collection_id(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_repo_get_config")]
#[doc(alias = "get_config")]
pub fn config(&self) -> Option<glib::KeyFile> {
- unsafe {
- from_glib_none(ffi::ostree_repo_get_config(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_repo_get_config(self.to_glib_none().0)) }
}
#[cfg(any(feature = "v2018_9", feature = "dox"))]
@@ -237,7 +391,9 @@ impl Repo {
#[doc(alias = "get_default_repo_finders")]
pub fn default_repo_finders(&self) -> Vec<glib::GString> {
unsafe {
- FromGlibPtrContainer::from_glib_none(ffi::ostree_repo_get_default_repo_finders(self.to_glib_none().0))
+ FromGlibPtrContainer::from_glib_none(ffi::ostree_repo_get_default_repo_finders(
+ self.to_glib_none().0,
+ ))
}
}
@@ -246,17 +402,13 @@ impl Repo {
#[doc(alias = "ostree_repo_get_dfd")]
#[doc(alias = "get_dfd")]
pub fn dfd(&self) -> i32 {
- unsafe {
- ffi::ostree_repo_get_dfd(self.to_glib_none().0)
- }
+ unsafe { ffi::ostree_repo_get_dfd(self.to_glib_none().0) }
}
#[doc(alias = "ostree_repo_get_disable_fsync")]
#[doc(alias = "get_disable_fsync")]
pub fn is_disable_fsync(&self) -> bool {
- unsafe {
- from_glib(ffi::ostree_repo_get_disable_fsync(self.to_glib_none().0))
- }
+ unsafe { from_glib(ffi::ostree_repo_get_disable_fsync(self.to_glib_none().0)) }
}
#[cfg(any(feature = "v2018_9", feature = "dox"))]
@@ -267,47 +419,68 @@ impl Repo {
unsafe {
let mut out_reserved_bytes = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_get_min_free_space_bytes(self.to_glib_none().0, out_reserved_bytes.as_mut_ptr(), &mut error);
+ let is_ok = ffi::ostree_repo_get_min_free_space_bytes(
+ self.to_glib_none().0,
+ out_reserved_bytes.as_mut_ptr(),
+ &mut error,
+ );
let out_reserved_bytes = out_reserved_bytes.assume_init();
- if error.is_null() { Ok(out_reserved_bytes) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(out_reserved_bytes)
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_get_mode")]
#[doc(alias = "get_mode")]
pub fn mode(&self) -> RepoMode {
- unsafe {
- from_glib(ffi::ostree_repo_get_mode(self.to_glib_none().0))
- }
+ unsafe { from_glib(ffi::ostree_repo_get_mode(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_repo_get_parent")]
#[doc(alias = "get_parent")]
+ #[must_use]
pub fn parent(&self) -> Option<Repo> {
- unsafe {
- from_glib_none(ffi::ostree_repo_get_parent(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_repo_get_parent(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_repo_get_path")]
#[doc(alias = "get_path")]
pub fn path(&self) -> Option<gio::File> {
- unsafe {
- from_glib_none(ffi::ostree_repo_get_path(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_repo_get_path(self.to_glib_none().0)) }
}
#[cfg(any(feature = "v2016_5", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))]
#[doc(alias = "ostree_repo_get_remote_boolean_option")]
#[doc(alias = "get_remote_boolean_option")]
- pub fn remote_boolean_option(&self, remote_name: &str, option_name: &str, default_value: bool) -> Result<bool, glib::Error> {
+ pub fn remote_boolean_option(
+ &self,
+ remote_name: &str,
+ option_name: &str,
+ default_value: bool,
+ ) -> Result<bool, glib::Error> {
unsafe {
let mut out_value = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_get_remote_boolean_option(self.to_glib_none().0, remote_name.to_glib_none().0, option_name.to_glib_none().0, default_value.into_glib(), out_value.as_mut_ptr(), &mut error);
+ let is_ok = ffi::ostree_repo_get_remote_boolean_option(
+ self.to_glib_none().0,
+ remote_name.to_glib_none().0,
+ option_name.to_glib_none().0,
+ default_value.into_glib(),
+ out_value.as_mut_ptr(),
+ &mut error,
+ );
let out_value = out_value.assume_init();
- if error.is_null() { Ok(from_glib(out_value)) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib(out_value))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -315,12 +488,27 @@ impl Repo {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))]
#[doc(alias = "ostree_repo_get_remote_list_option")]
#[doc(alias = "get_remote_list_option")]
- pub fn remote_list_option(&self, remote_name: &str, option_name: &str) -> Result<Vec<glib::GString>, glib::Error> {
+ pub fn remote_list_option(
+ &self,
+ remote_name: &str,
+ option_name: &str,
+ ) -> Result<Vec<glib::GString>, glib::Error> {
unsafe {
let mut out_value = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_get_remote_list_option(self.to_glib_none().0, remote_name.to_glib_none().0, option_name.to_glib_none().0, &mut out_value, &mut error);
- if error.is_null() { Ok(FromGlibPtrContainer::from_glib_full(out_value)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_get_remote_list_option(
+ self.to_glib_none().0,
+ remote_name.to_glib_none().0,
+ option_name.to_glib_none().0,
+ &mut out_value,
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(FromGlibPtrContainer::from_glib_full(out_value))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -328,46 +516,122 @@ impl Repo {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))]
#[doc(alias = "ostree_repo_get_remote_option")]
#[doc(alias = "get_remote_option")]
- pub fn remote_option(&self, remote_name: &str, option_name: &str, default_value: Option<&str>) -> Result<glib::GString, glib::Error> {
+ pub fn remote_option(
+ &self,
+ remote_name: &str,
+ option_name: &str,
+ default_value: Option<&str>,
+ ) -> Result<glib::GString, glib::Error> {
unsafe {
let mut out_value = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_get_remote_option(self.to_glib_none().0, remote_name.to_glib_none().0, option_name.to_glib_none().0, default_value.to_glib_none().0, &mut out_value, &mut error);
- if error.is_null() { Ok(from_glib_full(out_value)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_get_remote_option(
+ self.to_glib_none().0,
+ remote_name.to_glib_none().0,
+ option_name.to_glib_none().0,
+ default_value.to_glib_none().0,
+ &mut out_value,
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib_full(out_value))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2020_8", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_8")))]
#[doc(alias = "ostree_repo_gpg_sign_data")]
- pub fn gpg_sign_data<P: IsA<gio::Cancellable>>(&self, data: &glib::Bytes, old_signatures: &glib::Bytes, key_id: &[&str], homedir: Option<&str>, cancellable: Option<&P>) -> Result<glib::Bytes, glib::Error> {
+ pub fn gpg_sign_data(
+ &self,
+ data: &glib::Bytes,
+ old_signatures: &glib::Bytes,
+ key_id: &[&str],
+ homedir: Option<&str>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<glib::Bytes, glib::Error> {
unsafe {
let mut out_signatures = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_gpg_sign_data(self.to_glib_none().0, data.to_glib_none().0, old_signatures.to_glib_none().0, key_id.to_glib_none().0, homedir.to_glib_none().0, &mut out_signatures, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_signatures)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_gpg_sign_data(
+ self.to_glib_none().0,
+ data.to_glib_none().0,
+ old_signatures.to_glib_none().0,
+ key_id.to_glib_none().0,
+ homedir.to_glib_none().0,
+ &mut out_signatures,
+ 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(from_glib_full(out_signatures))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2016_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_6")))]
#[doc(alias = "ostree_repo_gpg_verify_data")]
- pub fn gpg_verify_data<P: IsA<gio::File>, Q: IsA<gio::File>, R: IsA<gio::Cancellable>>(&self, remote_name: Option<&str>, data: &glib::Bytes, signatures: &glib::Bytes, keyringdir: Option<&P>, extra_keyring: Option<&Q>, cancellable: Option<&R>) -> Result<GpgVerifyResult, glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let ret = ffi::ostree_repo_gpg_verify_data(self.to_glib_none().0, remote_name.to_glib_none().0, data.to_glib_none().0, signatures.to_glib_none().0, keyringdir.map(|p| p.as_ref()).to_glib_none().0, extra_keyring.map(|p| p.as_ref()).to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ pub fn gpg_verify_data(
+ &self,
+ remote_name: Option<&str>,
+ data: &glib::Bytes,
+ signatures: &glib::Bytes,
+ keyringdir: Option<&impl IsA<gio::File>>,
+ extra_keyring: Option<&impl IsA<gio::File>>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<GpgVerifyResult, glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let ret = ffi::ostree_repo_gpg_verify_data(
+ self.to_glib_none().0,
+ remote_name.to_glib_none().0,
+ data.to_glib_none().0,
+ signatures.to_glib_none().0,
+ keyringdir.map(|p| p.as_ref()).to_glib_none().0,
+ extra_keyring.map(|p| p.as_ref()).to_glib_none().0,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_has_object")]
- pub fn has_object<P: IsA<gio::Cancellable>>(&self, objtype: ObjectType, checksum: &str, cancellable: Option<&P>) -> Result<bool, glib::Error> {
+ pub fn has_object(
+ &self,
+ objtype: ObjectType,
+ checksum: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<bool, glib::Error> {
unsafe {
let mut out_have_object = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_has_object(self.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, out_have_object.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
+ let is_ok = ffi::ostree_repo_has_object(
+ self.to_glib_none().0,
+ objtype.into_glib(),
+ checksum.to_glib_none().0,
+ out_have_object.as_mut_ptr(),
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
let out_have_object = out_have_object.assume_init();
- if error.is_null() { Ok(from_glib(out_have_object)) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib(out_have_object))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -375,155 +639,282 @@ impl Repo {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_12")))]
#[doc(alias = "ostree_repo_hash")]
pub fn hash(&self) -> u32 {
- unsafe {
- ffi::ostree_repo_hash(self.to_glib_none().0)
- }
+ unsafe { ffi::ostree_repo_hash(self.to_glib_none().0) }
}
//#[doc(alias = "ostree_repo_import_archive_to_mtree")]
- //pub fn import_archive_to_mtree<P: IsA<gio::Cancellable>>(&self, opts: /*Ignored*/&mut RepoImportArchiveOptions, archive: /*Unimplemented*/Option<Fundamental: Pointer>, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ //pub fn import_archive_to_mtree(&self, opts: /*Ignored*/&mut RepoImportArchiveOptions, archive: /*Unimplemented*/Option<Fundamental: Pointer>, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_import_archive_to_mtree() }
//}
#[doc(alias = "ostree_repo_import_object_from")]
- pub fn import_object_from<P: IsA<gio::Cancellable>>(&self, source: &Repo, objtype: ObjectType, checksum: &str, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_import_object_from(self.to_glib_none().0, source.to_glib_none().0, objtype.into_glib(), checksum.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 import_object_from(
+ &self,
+ source: &Repo,
+ objtype: ObjectType,
+ checksum: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_import_object_from(
+ self.to_glib_none().0,
+ source.to_glib_none().0,
+ objtype.into_glib(),
+ checksum.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))
+ }
}
}
#[cfg(any(feature = "v2016_5", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))]
#[doc(alias = "ostree_repo_import_object_from_with_trust")]
- pub fn import_object_from_with_trust<P: IsA<gio::Cancellable>>(&self, source: &Repo, objtype: ObjectType, checksum: &str, trusted: bool, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_import_object_from_with_trust(self.to_glib_none().0, source.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, trusted.into_glib(), 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 import_object_from_with_trust(
+ &self,
+ source: &Repo,
+ objtype: ObjectType,
+ checksum: &str,
+ trusted: bool,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_import_object_from_with_trust(
+ self.to_glib_none().0,
+ source.to_glib_none().0,
+ objtype.into_glib(),
+ checksum.to_glib_none().0,
+ trusted.into_glib(),
+ 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_repo_is_system")]
pub fn is_system(&self) -> bool {
- unsafe {
- from_glib(ffi::ostree_repo_is_system(self.to_glib_none().0))
- }
+ unsafe { from_glib(ffi::ostree_repo_is_system(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_repo_is_writable")]
pub fn is_writable(&self) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_is_writable(self.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_is_writable(self.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))
+ }
}
}
//#[cfg(any(feature = "v2018_6", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
//#[doc(alias = "ostree_repo_list_collection_refs")]
- //pub fn list_collection_refs<P: IsA<gio::Cancellable>>(&self, match_collection_id: Option<&str>, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 28 }, flags: RepoListRefsExtFlags, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ //pub fn list_collection_refs(&self, match_collection_id: Option<&str>, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 28 }, flags: RepoListRefsExtFlags, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_list_collection_refs() }
//}
//#[doc(alias = "ostree_repo_list_objects")]
- //pub fn list_objects<P: IsA<gio::Cancellable>>(&self, flags: RepoListObjectsFlags, out_objects: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 2, id: 203 }/TypeId { ns_id: 2, id: 203 }, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ //pub fn list_objects(&self, flags: RepoListObjectsFlags, out_objects: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 2, id: 203 }/TypeId { ns_id: 2, id: 203 }, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_list_objects() }
//}
//#[doc(alias = "ostree_repo_list_refs")]
- //pub fn list_refs<P: IsA<gio::Cancellable>>(&self, refspec_prefix: Option<&str>, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ //pub fn list_refs(&self, refspec_prefix: Option<&str>, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_list_refs() }
//}
//#[cfg(any(feature = "v2016_4", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_4")))]
//#[doc(alias = "ostree_repo_list_refs_ext")]
- //pub fn list_refs_ext<P: IsA<gio::Cancellable>>(&self, refspec_prefix: Option<&str>, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, flags: RepoListRefsExtFlags, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ //pub fn list_refs_ext(&self, refspec_prefix: Option<&str>, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, flags: RepoListRefsExtFlags, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_list_refs_ext() }
//}
#[cfg(any(feature = "v2020_8", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_8")))]
#[doc(alias = "ostree_repo_list_static_delta_indexes")]
- pub fn list_static_delta_indexes<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<Vec<glib::GString>, glib::Error> {
+ pub fn list_static_delta_indexes(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<Vec<glib::GString>, glib::Error> {
unsafe {
let mut out_indexes = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_list_static_delta_indexes(self.to_glib_none().0, &mut out_indexes, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(FromGlibPtrContainer::from_glib_container(out_indexes)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_list_static_delta_indexes(
+ self.to_glib_none().0,
+ &mut out_indexes,
+ 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(FromGlibPtrContainer::from_glib_container(out_indexes))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_list_static_delta_names")]
- pub fn list_static_delta_names<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<Vec<glib::GString>, glib::Error> {
+ pub fn list_static_delta_names(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<Vec<glib::GString>, glib::Error> {
unsafe {
let mut out_deltas = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_list_static_delta_names(self.to_glib_none().0, &mut out_deltas, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(FromGlibPtrContainer::from_glib_container(out_deltas)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_list_static_delta_names(
+ self.to_glib_none().0,
+ &mut out_deltas,
+ 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(FromGlibPtrContainer::from_glib_container(out_deltas))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2015_7", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2015_7")))]
#[doc(alias = "ostree_repo_load_commit")]
- pub fn load_commit(&self, checksum: &str) -> Result<(glib::Variant, RepoCommitState), glib::Error> {
+ pub fn load_commit(
+ &self,
+ checksum: &str,
+ ) -> Result<(glib::Variant, RepoCommitState), glib::Error> {
unsafe {
let mut out_commit = ptr::null_mut();
let mut out_state = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_load_commit(self.to_glib_none().0, checksum.to_glib_none().0, &mut out_commit, out_state.as_mut_ptr(), &mut error);
+ let is_ok = ffi::ostree_repo_load_commit(
+ self.to_glib_none().0,
+ checksum.to_glib_none().0,
+ &mut out_commit,
+ out_state.as_mut_ptr(),
+ &mut error,
+ );
let out_state = out_state.assume_init();
- if error.is_null() { Ok((from_glib_full(out_commit), from_glib(out_state))) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok((from_glib_full(out_commit), from_glib(out_state)))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_load_object_stream")]
- pub fn load_object_stream<P: IsA<gio::Cancellable>>(&self, objtype: ObjectType, checksum: &str, cancellable: Option<&P>) -> Result<(gio::InputStream, u64), glib::Error> {
+ pub fn load_object_stream(
+ &self,
+ objtype: ObjectType,
+ checksum: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(gio::InputStream, u64), glib::Error> {
unsafe {
let mut out_input = ptr::null_mut();
let mut out_size = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_load_object_stream(self.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, &mut out_input, out_size.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
+ let is_ok = ffi::ostree_repo_load_object_stream(
+ self.to_glib_none().0,
+ objtype.into_glib(),
+ checksum.to_glib_none().0,
+ &mut out_input,
+ out_size.as_mut_ptr(),
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
let out_size = out_size.assume_init();
- if error.is_null() { Ok((from_glib_full(out_input), out_size)) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok((from_glib_full(out_input), out_size))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_load_variant")]
- pub fn load_variant(&self, objtype: ObjectType, sha256: &str) -> Result<glib::Variant, glib::Error> {
+ pub fn load_variant(
+ &self,
+ objtype: ObjectType,
+ sha256: &str,
+ ) -> Result<glib::Variant, glib::Error> {
unsafe {
let mut out_variant = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_load_variant(self.to_glib_none().0, objtype.into_glib(), sha256.to_glib_none().0, &mut out_variant, &mut error);
- if error.is_null() { Ok(from_glib_full(out_variant)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_load_variant(
+ self.to_glib_none().0,
+ objtype.into_glib(),
+ sha256.to_glib_none().0,
+ &mut out_variant,
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib_full(out_variant))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_load_variant_if_exists")]
- pub fn load_variant_if_exists(&self, objtype: ObjectType, sha256: &str) -> Result<Option<glib::Variant>, glib::Error> {
+ pub fn load_variant_if_exists(
+ &self,
+ objtype: ObjectType,
+ sha256: &str,
+ ) -> Result<Option<glib::Variant>, glib::Error> {
unsafe {
let mut out_variant = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_load_variant_if_exists(self.to_glib_none().0, objtype.into_glib(), sha256.to_glib_none().0, &mut out_variant, &mut error);
- if error.is_null() { Ok(from_glib_full(out_variant)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_load_variant_if_exists(
+ self.to_glib_none().0,
+ objtype.into_glib(),
+ sha256.to_glib_none().0,
+ &mut out_variant,
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib_full(out_variant))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
//#[cfg(any(feature = "v2021_3", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_3")))]
//#[doc(alias = "ostree_repo_lock_pop")]
- //pub fn lock_pop<P: IsA<gio::Cancellable>>(&self, lock_type: /*Ignored*/RepoLockType, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ //pub fn lock_pop(&self, lock_type: /*Ignored*/RepoLockType, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_lock_pop() }
//}
//#[cfg(any(feature = "v2021_3", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_3")))]
//#[doc(alias = "ostree_repo_lock_push")]
- //pub fn lock_push<P: IsA<gio::Cancellable>>(&self, lock_type: /*Ignored*/RepoLockType, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ //pub fn lock_push(&self, lock_type: /*Ignored*/RepoLockType, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_lock_push() }
//}
@@ -533,212 +924,539 @@ impl Repo {
pub fn mark_commit_partial(&self, checksum: &str, is_partial: bool) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_mark_commit_partial(self.to_glib_none().0, checksum.to_glib_none().0, is_partial.into_glib(), &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_mark_commit_partial(
+ self.to_glib_none().0,
+ checksum.to_glib_none().0,
+ is_partial.into_glib(),
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(())
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2019_4", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2019_4")))]
#[doc(alias = "ostree_repo_mark_commit_partial_reason")]
- pub fn mark_commit_partial_reason(&self, checksum: &str, is_partial: bool, in_state: RepoCommitState) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_mark_commit_partial_reason(self.to_glib_none().0, checksum.to_glib_none().0, is_partial.into_glib(), in_state.into_glib(), &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ pub fn mark_commit_partial_reason(
+ &self,
+ checksum: &str,
+ is_partial: bool,
+ in_state: RepoCommitState,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_mark_commit_partial_reason(
+ self.to_glib_none().0,
+ checksum.to_glib_none().0,
+ is_partial.into_glib(),
+ in_state.into_glib(),
+ &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_repo_open")]
- pub fn open<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn open(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_open(self.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)) }
+ let is_ok = ffi::ostree_repo_open(
+ self.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_repo_prepare_transaction")]
- pub fn prepare_transaction<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<bool, glib::Error> {
+ pub fn prepare_transaction(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<bool, glib::Error> {
unsafe {
let mut out_transaction_resume = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_prepare_transaction(self.to_glib_none().0, out_transaction_resume.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
+ let is_ok = ffi::ostree_repo_prepare_transaction(
+ self.to_glib_none().0,
+ out_transaction_resume.as_mut_ptr(),
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
let out_transaction_resume = out_transaction_resume.assume_init();
- if error.is_null() { Ok(from_glib(out_transaction_resume)) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib(out_transaction_resume))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_prune")]
- pub fn prune<P: IsA<gio::Cancellable>>(&self, flags: RepoPruneFlags, depth: i32, cancellable: Option<&P>) -> Result<(i32, i32, u64), glib::Error> {
+ pub fn prune(
+ &self,
+ flags: RepoPruneFlags,
+ depth: i32,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(i32, i32, u64), glib::Error> {
unsafe {
let mut out_objects_total = mem::MaybeUninit::uninit();
let mut out_objects_pruned = mem::MaybeUninit::uninit();
let mut out_pruned_object_size_total = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_prune(self.to_glib_none().0, flags.into_glib(), depth, out_objects_total.as_mut_ptr(), out_objects_pruned.as_mut_ptr(), out_pruned_object_size_total.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
+ let is_ok = ffi::ostree_repo_prune(
+ self.to_glib_none().0,
+ flags.into_glib(),
+ depth,
+ out_objects_total.as_mut_ptr(),
+ out_objects_pruned.as_mut_ptr(),
+ out_pruned_object_size_total.as_mut_ptr(),
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
let out_objects_total = out_objects_total.assume_init();
let out_objects_pruned = out_objects_pruned.assume_init();
let out_pruned_object_size_total = out_pruned_object_size_total.assume_init();
- if error.is_null() { Ok((out_objects_total, out_objects_pruned, out_pruned_object_size_total)) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok((
+ out_objects_total,
+ out_objects_pruned,
+ out_pruned_object_size_total,
+ ))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
//#[cfg(any(feature = "v2017_1", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_1")))]
//#[doc(alias = "ostree_repo_prune_from_reachable")]
- //pub fn prune_from_reachable<P: IsA<gio::Cancellable>>(&self, options: /*Ignored*/&mut RepoPruneOptions, cancellable: Option<&P>) -> Result<(i32, i32, u64), glib::Error> {
+ //pub fn prune_from_reachable(&self, options: /*Ignored*/&mut RepoPruneOptions, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(i32, i32, u64), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_prune_from_reachable() }
//}
#[doc(alias = "ostree_repo_prune_static_deltas")]
- pub fn prune_static_deltas<P: IsA<gio::Cancellable>>(&self, commit: Option<&str>, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn prune_static_deltas(
+ &self,
+ commit: Option<&str>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_prune_static_deltas(self.to_glib_none().0, commit.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)) }
+ let is_ok = ffi::ostree_repo_prune_static_deltas(
+ self.to_glib_none().0,
+ commit.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_repo_pull")]
- pub fn pull<P: IsA<gio::Cancellable>>(&self, remote_name: &str, refs_to_fetch: &[&str], flags: RepoPullFlags, progress: Option<&AsyncProgress>, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_pull(self.to_glib_none().0, remote_name.to_glib_none().0, refs_to_fetch.to_glib_none().0, flags.into_glib(), progress.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 pull(
+ &self,
+ remote_name: &str,
+ refs_to_fetch: &[&str],
+ flags: RepoPullFlags,
+ progress: Option<&AsyncProgress>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_pull(
+ self.to_glib_none().0,
+ remote_name.to_glib_none().0,
+ refs_to_fetch.to_glib_none().0,
+ flags.into_glib(),
+ progress.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_repo_pull_one_dir")]
- pub fn pull_one_dir<P: IsA<gio::Cancellable>>(&self, remote_name: &str, dir_to_pull: &str, refs_to_fetch: &[&str], flags: RepoPullFlags, progress: Option<&AsyncProgress>, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_pull_one_dir(self.to_glib_none().0, remote_name.to_glib_none().0, dir_to_pull.to_glib_none().0, refs_to_fetch.to_glib_none().0, flags.into_glib(), progress.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 pull_one_dir(
+ &self,
+ remote_name: &str,
+ dir_to_pull: &str,
+ refs_to_fetch: &[&str],
+ flags: RepoPullFlags,
+ progress: Option<&AsyncProgress>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_pull_one_dir(
+ self.to_glib_none().0,
+ remote_name.to_glib_none().0,
+ dir_to_pull.to_glib_none().0,
+ refs_to_fetch.to_glib_none().0,
+ flags.into_glib(),
+ progress.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_repo_pull_with_options")]
- pub fn pull_with_options<P: IsA<gio::Cancellable>>(&self, remote_name_or_baseurl: &str, options: &glib::Variant, progress: Option<&AsyncProgress>, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_pull_with_options(self.to_glib_none().0, remote_name_or_baseurl.to_glib_none().0, options.to_glib_none().0, progress.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 pull_with_options(
+ &self,
+ remote_name_or_baseurl: &str,
+ options: &glib::Variant,
+ progress: Option<&AsyncProgress>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_pull_with_options(
+ self.to_glib_none().0,
+ remote_name_or_baseurl.to_glib_none().0,
+ options.to_glib_none().0,
+ progress.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_repo_query_object_storage_size")]
- pub fn query_object_storage_size<P: IsA<gio::Cancellable>>(&self, objtype: ObjectType, sha256: &str, cancellable: Option<&P>) -> Result<u64, glib::Error> {
+ pub fn query_object_storage_size(
+ &self,
+ objtype: ObjectType,
+ sha256: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<u64, glib::Error> {
unsafe {
let mut out_size = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_query_object_storage_size(self.to_glib_none().0, objtype.into_glib(), sha256.to_glib_none().0, out_size.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
+ let is_ok = ffi::ostree_repo_query_object_storage_size(
+ self.to_glib_none().0,
+ objtype.into_glib(),
+ sha256.to_glib_none().0,
+ out_size.as_mut_ptr(),
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
let out_size = out_size.assume_init();
- if error.is_null() { Ok(out_size) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(out_size)
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_read_commit")]
- pub fn read_commit<P: IsA<gio::Cancellable>>(&self, ref_: &str, cancellable: Option<&P>) -> Result<(gio::File, glib::GString), glib::Error> {
+ pub fn read_commit(
+ &self,
+ ref_: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(gio::File, glib::GString), glib::Error> {
unsafe {
let mut out_root = ptr::null_mut();
let mut out_commit = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_read_commit(self.to_glib_none().0, ref_.to_glib_none().0, &mut out_root, &mut out_commit, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok((from_glib_full(out_root), from_glib_full(out_commit))) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_read_commit(
+ self.to_glib_none().0,
+ ref_.to_glib_none().0,
+ &mut out_root,
+ &mut out_commit,
+ 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((from_glib_full(out_root), from_glib_full(out_commit)))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_read_commit_detached_metadata")]
- pub fn read_commit_detached_metadata<P: IsA<gio::Cancellable>>(&self, checksum: &str, cancellable: Option<&P>) -> Result<Option<glib::Variant>, glib::Error> {
+ pub fn read_commit_detached_metadata(
+ &self,
+ checksum: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<Option<glib::Variant>, glib::Error> {
unsafe {
let mut out_metadata = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_read_commit_detached_metadata(self.to_glib_none().0, checksum.to_glib_none().0, &mut out_metadata, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_metadata)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_read_commit_detached_metadata(
+ self.to_glib_none().0,
+ checksum.to_glib_none().0,
+ &mut out_metadata,
+ 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(from_glib_full(out_metadata))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_regenerate_summary")]
- pub fn regenerate_summary<P: IsA<gio::Cancellable>>(&self, additional_metadata: Option<&glib::Variant>, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn regenerate_summary(
+ &self,
+ additional_metadata: Option<&glib::Variant>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_regenerate_summary(self.to_glib_none().0, additional_metadata.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)) }
+ let is_ok = ffi::ostree_repo_regenerate_summary(
+ self.to_glib_none().0,
+ additional_metadata.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))
+ }
}
}
#[cfg(any(feature = "v2017_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_2")))]
#[doc(alias = "ostree_repo_reload_config")]
- pub fn reload_config<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn reload_config(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_reload_config(self.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)) }
+ let is_ok = ffi::ostree_repo_reload_config(
+ self.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_repo_remote_add")]
- pub fn remote_add<P: IsA<gio::Cancellable>>(&self, name: &str, url: Option<&str>, options: Option<&glib::Variant>, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_remote_add(self.to_glib_none().0, name.to_glib_none().0, url.to_glib_none().0, options.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 remote_add(
+ &self,
+ name: &str,
+ url: Option<&str>,
+ options: Option<&glib::Variant>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_remote_add(
+ self.to_glib_none().0,
+ name.to_glib_none().0,
+ url.to_glib_none().0,
+ options.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_repo_remote_change")]
- pub fn remote_change<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(&self, sysroot: Option<&P>, changeop: RepoRemoteChange, name: &str, url: Option<&str>, options: Option<&glib::Variant>, cancellable: Option<&Q>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_remote_change(self.to_glib_none().0, sysroot.map(|p| p.as_ref()).to_glib_none().0, changeop.into_glib(), name.to_glib_none().0, url.to_glib_none().0, options.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 remote_change(
+ &self,
+ sysroot: Option<&impl IsA<gio::File>>,
+ changeop: RepoRemoteChange,
+ name: &str,
+ url: Option<&str>,
+ options: Option<&glib::Variant>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_remote_change(
+ self.to_glib_none().0,
+ sysroot.map(|p| p.as_ref()).to_glib_none().0,
+ changeop.into_glib(),
+ name.to_glib_none().0,
+ url.to_glib_none().0,
+ options.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_repo_remote_delete")]
- pub fn remote_delete<P: IsA<gio::Cancellable>>(&self, name: &str, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn remote_delete(
+ &self,
+ name: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_remote_delete(self.to_glib_none().0, name.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)) }
+ let is_ok = ffi::ostree_repo_remote_delete(
+ self.to_glib_none().0,
+ name.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_repo_remote_fetch_summary")]
- pub fn remote_fetch_summary<P: IsA<gio::Cancellable>>(&self, name: &str, cancellable: Option<&P>) -> Result<(glib::Bytes, glib::Bytes), glib::Error> {
+ pub fn remote_fetch_summary(
+ &self,
+ name: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(glib::Bytes, glib::Bytes), glib::Error> {
unsafe {
let mut out_summary = ptr::null_mut();
let mut out_signatures = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_remote_fetch_summary(self.to_glib_none().0, name.to_glib_none().0, &mut out_summary, &mut out_signatures, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok((from_glib_full(out_summary), from_glib_full(out_signatures))) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_remote_fetch_summary(
+ self.to_glib_none().0,
+ name.to_glib_none().0,
+ &mut out_summary,
+ &mut out_signatures,
+ 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((from_glib_full(out_summary), from_glib_full(out_signatures)))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2016_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_6")))]
#[doc(alias = "ostree_repo_remote_fetch_summary_with_options")]
- pub fn remote_fetch_summary_with_options<P: IsA<gio::Cancellable>>(&self, name: &str, options: Option<&glib::Variant>, cancellable: Option<&P>) -> Result<(glib::Bytes, glib::Bytes), glib::Error> {
+ pub fn remote_fetch_summary_with_options(
+ &self,
+ name: &str,
+ options: Option<&glib::Variant>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(glib::Bytes, glib::Bytes), glib::Error> {
unsafe {
let mut out_summary = ptr::null_mut();
let mut out_signatures = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_remote_fetch_summary_with_options(self.to_glib_none().0, name.to_glib_none().0, options.to_glib_none().0, &mut out_summary, &mut out_signatures, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok((from_glib_full(out_summary), from_glib_full(out_signatures))) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_remote_fetch_summary_with_options(
+ self.to_glib_none().0,
+ name.to_glib_none().0,
+ options.to_glib_none().0,
+ &mut out_summary,
+ &mut out_signatures,
+ 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((from_glib_full(out_summary), from_glib_full(out_signatures)))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2021_4", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_4")))]
#[doc(alias = "ostree_repo_remote_get_gpg_keys")]
- pub fn remote_get_gpg_keys<P: IsA<gio::Cancellable>>(&self, name: Option<&str>, key_ids: &[&str], cancellable: Option<&P>) -> Result<Vec<glib::Variant>, glib::Error> {
+ pub fn remote_get_gpg_keys(
+ &self,
+ name: Option<&str>,
+ key_ids: &[&str],
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<Vec<glib::Variant>, glib::Error> {
unsafe {
let mut out_keys = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_remote_get_gpg_keys(self.to_glib_none().0, name.to_glib_none().0, key_ids.to_glib_none().0, &mut out_keys, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(FromGlibPtrContainer::from_glib_container(out_keys)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_remote_get_gpg_keys(
+ self.to_glib_none().0,
+ name.to_glib_none().0,
+ key_ids.to_glib_none().0,
+ &mut out_keys,
+ 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(FromGlibPtrContainer::from_glib_container(out_keys))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -747,9 +1465,19 @@ impl Repo {
unsafe {
let mut out_gpg_verify = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_remote_get_gpg_verify(self.to_glib_none().0, name.to_glib_none().0, out_gpg_verify.as_mut_ptr(), &mut error);
+ let is_ok = ffi::ostree_repo_remote_get_gpg_verify(
+ self.to_glib_none().0,
+ name.to_glib_none().0,
+ out_gpg_verify.as_mut_ptr(),
+ &mut error,
+ );
let out_gpg_verify = out_gpg_verify.assume_init();
- if error.is_null() { Ok(from_glib(out_gpg_verify)) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib(out_gpg_verify))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -758,9 +1486,19 @@ impl Repo {
unsafe {
let mut out_gpg_verify_summary = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_remote_get_gpg_verify_summary(self.to_glib_none().0, name.to_glib_none().0, out_gpg_verify_summary.as_mut_ptr(), &mut error);
+ let is_ok = ffi::ostree_repo_remote_get_gpg_verify_summary(
+ self.to_glib_none().0,
+ name.to_glib_none().0,
+ out_gpg_verify_summary.as_mut_ptr(),
+ &mut error,
+ );
let out_gpg_verify_summary = out_gpg_verify_summary.assume_init();
- if error.is_null() { Ok(from_glib(out_gpg_verify_summary)) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib(out_gpg_verify_summary))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -769,19 +1507,48 @@ impl Repo {
unsafe {
let mut out_url = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_remote_get_url(self.to_glib_none().0, name.to_glib_none().0, &mut out_url, &mut error);
- if error.is_null() { Ok(from_glib_full(out_url)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_remote_get_url(
+ self.to_glib_none().0,
+ name.to_glib_none().0,
+ &mut out_url,
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib_full(out_url))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_remote_gpg_import")]
- pub fn remote_gpg_import<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(&self, name: &str, source_stream: Option<&P>, key_ids: &[&str], cancellable: Option<&Q>) -> Result<u32, glib::Error> {
+ pub fn remote_gpg_import(
+ &self,
+ name: &str,
+ source_stream: Option<&impl IsA<gio::InputStream>>,
+ key_ids: &[&str],
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<u32, glib::Error> {
unsafe {
let mut out_imported = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_remote_gpg_import(self.to_glib_none().0, name.to_glib_none().0, source_stream.map(|p| p.as_ref()).to_glib_none().0, key_ids.to_glib_none().0, out_imported.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
+ let is_ok = ffi::ostree_repo_remote_gpg_import(
+ self.to_glib_none().0,
+ name.to_glib_none().0,
+ source_stream.map(|p| p.as_ref()).to_glib_none().0,
+ key_ids.to_glib_none().0,
+ out_imported.as_mut_ptr(),
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
let out_imported = out_imported.assume_init();
- if error.is_null() { Ok(out_imported) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(out_imported)
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -789,7 +1556,10 @@ impl Repo {
pub fn remote_list(&self) -> Vec<glib::GString> {
unsafe {
let mut out_n_remotes = mem::MaybeUninit::uninit();
- let ret = FromGlibContainer::from_glib_full_num(ffi::ostree_repo_remote_list(self.to_glib_none().0, out_n_remotes.as_mut_ptr()), out_n_remotes.assume_init() as usize);
+ let ret = FromGlibContainer::from_glib_full_num(
+ ffi::ostree_repo_remote_list(self.to_glib_none().0, out_n_remotes.as_mut_ptr()),
+ out_n_remotes.assume_init() as usize,
+ );
ret
}
}
@@ -797,88 +1567,198 @@ impl Repo {
//#[cfg(any(feature = "v2018_6", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
//#[doc(alias = "ostree_repo_remote_list_collection_refs")]
- //pub fn remote_list_collection_refs<P: IsA<gio::Cancellable>>(&self, remote_name: &str, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 28 }, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ //pub fn remote_list_collection_refs(&self, remote_name: &str, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 28 }, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_remote_list_collection_refs() }
//}
//#[doc(alias = "ostree_repo_remote_list_refs")]
- //pub fn remote_list_refs<P: IsA<gio::Cancellable>>(&self, remote_name: &str, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ //pub fn remote_list_refs(&self, remote_name: &str, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_remote_list_refs() }
//}
#[cfg(any(feature = "v2018_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
#[doc(alias = "ostree_repo_resolve_collection_ref")]
- pub fn resolve_collection_ref<P: IsA<gio::Cancellable>>(&self, ref_: &CollectionRef, allow_noent: bool, flags: RepoResolveRevExtFlags, cancellable: Option<&P>) -> Result<Option<glib::GString>, glib::Error> {
+ pub fn resolve_collection_ref(
+ &self,
+ ref_: &CollectionRef,
+ allow_noent: bool,
+ flags: RepoResolveRevExtFlags,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<Option<glib::GString>, glib::Error> {
unsafe {
let mut out_rev = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_resolve_collection_ref(self.to_glib_none().0, ref_.to_glib_none().0, allow_noent.into_glib(), flags.into_glib(), &mut out_rev, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_rev)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_resolve_collection_ref(
+ self.to_glib_none().0,
+ ref_.to_glib_none().0,
+ allow_noent.into_glib(),
+ flags.into_glib(),
+ &mut out_rev,
+ 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(from_glib_full(out_rev))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2018_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
#[doc(alias = "ostree_repo_resolve_keyring_for_collection")]
- pub fn resolve_keyring_for_collection<P: IsA<gio::Cancellable>>(&self, collection_id: &str, cancellable: Option<&P>) -> Result<Remote, glib::Error> {
+ pub fn resolve_keyring_for_collection(
+ &self,
+ collection_id: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<Remote, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let ret = ffi::ostree_repo_resolve_keyring_for_collection(self.to_glib_none().0, collection_id.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ let ret = ffi::ostree_repo_resolve_keyring_for_collection(
+ self.to_glib_none().0,
+ collection_id.to_glib_none().0,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_resolve_rev")]
- pub fn resolve_rev(&self, refspec: &str, allow_noent: bool) -> Result<Option<glib::GString>, glib::Error> {
+ pub fn resolve_rev(
+ &self,
+ refspec: &str,
+ allow_noent: bool,
+ ) -> Result<Option<glib::GString>, glib::Error> {
unsafe {
let mut out_rev = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_resolve_rev(self.to_glib_none().0, refspec.to_glib_none().0, allow_noent.into_glib(), &mut out_rev, &mut error);
- if error.is_null() { Ok(from_glib_full(out_rev)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_resolve_rev(
+ self.to_glib_none().0,
+ refspec.to_glib_none().0,
+ allow_noent.into_glib(),
+ &mut out_rev,
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib_full(out_rev))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2016_7", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_7")))]
#[doc(alias = "ostree_repo_resolve_rev_ext")]
- pub fn resolve_rev_ext(&self, refspec: &str, allow_noent: bool, flags: RepoResolveRevExtFlags) -> Result<Option<glib::GString>, glib::Error> {
+ pub fn resolve_rev_ext(
+ &self,
+ refspec: &str,
+ allow_noent: bool,
+ flags: RepoResolveRevExtFlags,
+ ) -> Result<Option<glib::GString>, glib::Error> {
unsafe {
let mut out_rev = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_resolve_rev_ext(self.to_glib_none().0, refspec.to_glib_none().0, allow_noent.into_glib(), flags.into_glib(), &mut out_rev, &mut error);
- if error.is_null() { Ok(from_glib_full(out_rev)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_resolve_rev_ext(
+ self.to_glib_none().0,
+ refspec.to_glib_none().0,
+ allow_noent.into_glib(),
+ flags.into_glib(),
+ &mut out_rev,
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib_full(out_rev))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_scan_hardlinks")]
- pub fn scan_hardlinks<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn scan_hardlinks(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_scan_hardlinks(self.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)) }
+ let is_ok = ffi::ostree_repo_scan_hardlinks(
+ self.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))
+ }
}
}
#[cfg(any(feature = "v2017_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))]
#[doc(alias = "ostree_repo_set_alias_ref_immediate")]
- pub fn set_alias_ref_immediate<P: IsA<gio::Cancellable>>(&self, remote: Option<&str>, ref_: &str, target: Option<&str>, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_set_alias_ref_immediate(self.to_glib_none().0, remote.to_glib_none().0, ref_.to_glib_none().0, target.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_alias_ref_immediate(
+ &self,
+ remote: Option<&str>,
+ ref_: &str,
+ target: Option<&str>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_set_alias_ref_immediate(
+ self.to_glib_none().0,
+ remote.to_glib_none().0,
+ ref_.to_glib_none().0,
+ target.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))
+ }
}
}
#[cfg(any(feature = "v2016_5", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))]
#[doc(alias = "ostree_repo_set_cache_dir")]
- pub fn set_cache_dir<P: IsA<gio::Cancellable>>(&self, dfd: i32, path: &str, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_set_cache_dir(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_cache_dir(
+ &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_repo_set_cache_dir(
+ 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))
+ }
}
}
@@ -888,19 +1768,44 @@ impl Repo {
pub fn set_collection_id(&self, collection_id: Option<&str>) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_set_collection_id(self.to_glib_none().0, collection_id.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_set_collection_id(
+ self.to_glib_none().0,
+ collection_id.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))
+ }
}
}
#[cfg(any(feature = "v2018_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
#[doc(alias = "ostree_repo_set_collection_ref_immediate")]
- pub fn set_collection_ref_immediate<P: IsA<gio::Cancellable>>(&self, ref_: &CollectionRef, checksum: Option<&str>, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_set_collection_ref_immediate(self.to_glib_none().0, ref_.to_glib_none().0, checksum.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_collection_ref_immediate(
+ &self,
+ ref_: &CollectionRef,
+ checksum: Option<&str>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_set_collection_ref_immediate(
+ self.to_glib_none().0,
+ ref_.to_glib_none().0,
+ checksum.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))
+ }
}
}
@@ -912,89 +1817,235 @@ impl Repo {
}
#[doc(alias = "ostree_repo_set_ref_immediate")]
- pub fn set_ref_immediate<P: IsA<gio::Cancellable>>(&self, remote: Option<&str>, ref_: &str, checksum: Option<&str>, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_set_ref_immediate(self.to_glib_none().0, remote.to_glib_none().0, ref_.to_glib_none().0, checksum.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_ref_immediate(
+ &self,
+ remote: Option<&str>,
+ ref_: &str,
+ checksum: Option<&str>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_set_ref_immediate(
+ self.to_glib_none().0,
+ remote.to_glib_none().0,
+ ref_.to_glib_none().0,
+ checksum.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_repo_sign_commit")]
- pub fn sign_commit<P: IsA<gio::Cancellable>>(&self, commit_checksum: &str, key_id: &str, homedir: Option<&str>, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_sign_commit(self.to_glib_none().0, commit_checksum.to_glib_none().0, key_id.to_glib_none().0, homedir.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 sign_commit(
+ &self,
+ commit_checksum: &str,
+ key_id: &str,
+ homedir: Option<&str>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_sign_commit(
+ self.to_glib_none().0,
+ commit_checksum.to_glib_none().0,
+ key_id.to_glib_none().0,
+ homedir.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_repo_sign_delta")]
- pub fn sign_delta<P: IsA<gio::Cancellable>>(&self, from_commit: &str, to_commit: &str, key_id: &str, homedir: &str, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_sign_delta(self.to_glib_none().0, from_commit.to_glib_none().0, to_commit.to_glib_none().0, key_id.to_glib_none().0, homedir.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 sign_delta(
+ &self,
+ from_commit: &str,
+ to_commit: &str,
+ key_id: &str,
+ homedir: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_sign_delta(
+ self.to_glib_none().0,
+ from_commit.to_glib_none().0,
+ to_commit.to_glib_none().0,
+ key_id.to_glib_none().0,
+ homedir.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))
+ }
}
}
#[cfg(any(feature = "v2021_4", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_4")))]
#[doc(alias = "ostree_repo_signature_verify_commit_data")]
- pub fn signature_verify_commit_data(&self, remote_name: &str, commit_data: &glib::Bytes, commit_metadata: &glib::Bytes, flags: RepoVerifyFlags) -> Result<Option<glib::GString>, glib::Error> {
+ pub fn signature_verify_commit_data(
+ &self,
+ remote_name: &str,
+ commit_data: &glib::Bytes,
+ commit_metadata: &glib::Bytes,
+ flags: RepoVerifyFlags,
+ ) -> Result<Option<glib::GString>, glib::Error> {
unsafe {
let mut out_results = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_signature_verify_commit_data(self.to_glib_none().0, remote_name.to_glib_none().0, commit_data.to_glib_none().0, commit_metadata.to_glib_none().0, flags.into_glib(), &mut out_results, &mut error);
- if error.is_null() { Ok(from_glib_full(out_results)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_signature_verify_commit_data(
+ self.to_glib_none().0,
+ remote_name.to_glib_none().0,
+ commit_data.to_glib_none().0,
+ commit_metadata.to_glib_none().0,
+ flags.into_glib(),
+ &mut out_results,
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib_full(out_results))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_static_delta_execute_offline")]
- pub fn static_delta_execute_offline<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(&self, dir_or_file: &P, skip_validation: bool, cancellable: Option<&Q>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_static_delta_execute_offline(self.to_glib_none().0, dir_or_file.as_ref().to_glib_none().0, skip_validation.into_glib(), 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 static_delta_execute_offline(
+ &self,
+ dir_or_file: &impl IsA<gio::File>,
+ skip_validation: bool,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_static_delta_execute_offline(
+ self.to_glib_none().0,
+ dir_or_file.as_ref().to_glib_none().0,
+ skip_validation.into_glib(),
+ 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))
+ }
}
}
#[cfg(any(feature = "v2020_7", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))]
#[doc(alias = "ostree_repo_static_delta_execute_offline_with_signature")]
- pub fn static_delta_execute_offline_with_signature<P: IsA<gio::File>, Q: IsA<Sign>, R: IsA<gio::Cancellable>>(&self, dir_or_file: &P, sign: &Q, skip_validation: bool, cancellable: Option<&R>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_static_delta_execute_offline_with_signature(self.to_glib_none().0, dir_or_file.as_ref().to_glib_none().0, sign.as_ref().to_glib_none().0, skip_validation.into_glib(), 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 static_delta_execute_offline_with_signature(
+ &self,
+ dir_or_file: &impl IsA<gio::File>,
+ sign: &impl IsA<Sign>,
+ skip_validation: bool,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_static_delta_execute_offline_with_signature(
+ self.to_glib_none().0,
+ dir_or_file.as_ref().to_glib_none().0,
+ sign.as_ref().to_glib_none().0,
+ skip_validation.into_glib(),
+ 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_repo_static_delta_generate")]
- pub fn static_delta_generate<P: IsA<gio::Cancellable>>(&self, opt: StaticDeltaGenerateOpt, from: Option<&str>, to: &str, metadata: Option<&glib::Variant>, params: Option<&glib::Variant>, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_static_delta_generate(self.to_glib_none().0, opt.into_glib(), from.to_glib_none().0, to.to_glib_none().0, metadata.to_glib_none().0, params.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 static_delta_generate(
+ &self,
+ opt: StaticDeltaGenerateOpt,
+ from: Option<&str>,
+ to: &str,
+ metadata: Option<&glib::Variant>,
+ params: Option<&glib::Variant>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_static_delta_generate(
+ self.to_glib_none().0,
+ opt.into_glib(),
+ from.to_glib_none().0,
+ to.to_glib_none().0,
+ metadata.to_glib_none().0,
+ params.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))
+ }
}
}
//#[cfg(any(feature = "v2020_8", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_8")))]
//#[doc(alias = "ostree_repo_static_delta_reindex")]
- //pub fn static_delta_reindex<P: IsA<gio::Cancellable>>(&self, flags: /*Ignored*/StaticDeltaIndexFlags, opt_to_commit: &str, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ //pub fn static_delta_reindex(&self, flags: /*Ignored*/StaticDeltaIndexFlags, opt_to_commit: &str, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_static_delta_reindex() }
//}
#[cfg(any(feature = "v2020_7", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))]
#[doc(alias = "ostree_repo_static_delta_verify_signature")]
- pub fn static_delta_verify_signature<P: IsA<Sign>>(&self, delta_id: &str, sign: &P) -> Result<Option<glib::GString>, glib::Error> {
+ pub fn static_delta_verify_signature(
+ &self,
+ delta_id: &str,
+ sign: &impl IsA<Sign>,
+ ) -> Result<Option<glib::GString>, glib::Error> {
unsafe {
let mut out_success_message = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_static_delta_verify_signature(self.to_glib_none().0, delta_id.to_glib_none().0, sign.as_ref().to_glib_none().0, &mut out_success_message, &mut error);
- if error.is_null() { Ok(from_glib_full(out_success_message)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_static_delta_verify_signature(
+ self.to_glib_none().0,
+ delta_id.to_glib_none().0,
+ sign.as_ref().to_glib_none().0,
+ &mut out_success_message,
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib_full(out_success_message))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -1003,137 +2054,321 @@ impl Repo {
#[doc(alias = "ostree_repo_transaction_set_collection_ref")]
pub fn transaction_set_collection_ref(&self, ref_: &CollectionRef, checksum: Option<&str>) {
unsafe {
- ffi::ostree_repo_transaction_set_collection_ref(self.to_glib_none().0, ref_.to_glib_none().0, checksum.to_glib_none().0);
+ ffi::ostree_repo_transaction_set_collection_ref(
+ self.to_glib_none().0,
+ ref_.to_glib_none().0,
+ checksum.to_glib_none().0,
+ );
}
}
#[doc(alias = "ostree_repo_transaction_set_ref")]
pub fn transaction_set_ref(&self, remote: Option<&str>, ref_: &str, checksum: Option<&str>) {
unsafe {
- ffi::ostree_repo_transaction_set_ref(self.to_glib_none().0, remote.to_glib_none().0, ref_.to_glib_none().0, checksum.to_glib_none().0);
+ ffi::ostree_repo_transaction_set_ref(
+ self.to_glib_none().0,
+ remote.to_glib_none().0,
+ ref_.to_glib_none().0,
+ checksum.to_glib_none().0,
+ );
}
}
#[doc(alias = "ostree_repo_transaction_set_refspec")]
pub fn transaction_set_refspec(&self, refspec: &str, checksum: Option<&str>) {
unsafe {
- ffi::ostree_repo_transaction_set_refspec(self.to_glib_none().0, refspec.to_glib_none().0, checksum.to_glib_none().0);
+ ffi::ostree_repo_transaction_set_refspec(
+ self.to_glib_none().0,
+ refspec.to_glib_none().0,
+ checksum.to_glib_none().0,
+ );
}
}
//#[doc(alias = "ostree_repo_traverse_commit")]
- //pub fn traverse_commit<P: IsA<gio::Cancellable>>(&self, commit_checksum: &str, maxdepth: i32, out_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 2, id: 203 }/TypeId { ns_id: 2, id: 203 }, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ //pub fn traverse_commit(&self, commit_checksum: &str, maxdepth: i32, out_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 2, id: 203 }/TypeId { ns_id: 2, id: 203 }, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_traverse_commit() }
//}
//#[doc(alias = "ostree_repo_traverse_commit_union")]
- //pub fn traverse_commit_union<P: IsA<gio::Cancellable>>(&self, commit_checksum: &str, maxdepth: i32, inout_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ //pub fn traverse_commit_union(&self, commit_checksum: &str, maxdepth: i32, inout_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_traverse_commit_union() }
//}
//#[cfg(any(feature = "v2018_5", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_5")))]
//#[doc(alias = "ostree_repo_traverse_commit_union_with_parents")]
- //pub fn traverse_commit_union_with_parents<P: IsA<gio::Cancellable>>(&self, commit_checksum: &str, maxdepth: i32, inout_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, inout_parents: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ //pub fn traverse_commit_union_with_parents(&self, commit_checksum: &str, maxdepth: i32, inout_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, inout_parents: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_traverse_commit_union_with_parents() }
//}
//#[cfg(any(feature = "v2018_5", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_5")))]
//#[doc(alias = "ostree_repo_traverse_commit_with_flags")]
- //pub fn traverse_commit_with_flags<P: IsA<gio::Cancellable>>(&self, flags: RepoCommitTraverseFlags, commit_checksum: &str, maxdepth: i32, inout_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, inout_parents: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ //pub fn traverse_commit_with_flags(&self, flags: RepoCommitTraverseFlags, commit_checksum: &str, maxdepth: i32, inout_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, inout_parents: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_traverse_commit_with_flags() }
//}
//#[cfg(any(feature = "v2018_6", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
//#[doc(alias = "ostree_repo_traverse_reachable_refs")]
- //pub fn traverse_reachable_refs<P: IsA<gio::Cancellable>>(&self, depth: u32, reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 2, id: 203 }/TypeId { ns_id: 2, id: 203 }, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ //pub fn traverse_reachable_refs(&self, depth: u32, reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 2, id: 203 }/TypeId { ns_id: 2, id: 203 }, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
// unsafe { TODO: call ffi:ostree_repo_traverse_reachable_refs() }
//}
#[doc(alias = "ostree_repo_verify_commit")]
- pub fn verify_commit<P: IsA<gio::File>, Q: IsA<gio::File>, R: IsA<gio::Cancellable>>(&self, commit_checksum: &str, keyringdir: Option<&P>, extra_keyring: Option<&Q>, cancellable: Option<&R>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_verify_commit(self.to_glib_none().0, commit_checksum.to_glib_none().0, keyringdir.map(|p| p.as_ref()).to_glib_none().0, extra_keyring.map(|p| p.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 verify_commit(
+ &self,
+ commit_checksum: &str,
+ keyringdir: Option<&impl IsA<gio::File>>,
+ extra_keyring: Option<&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_repo_verify_commit(
+ self.to_glib_none().0,
+ commit_checksum.to_glib_none().0,
+ keyringdir.map(|p| p.as_ref()).to_glib_none().0,
+ extra_keyring.map(|p| p.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_repo_verify_commit_ext")]
- pub fn verify_commit_ext<P: IsA<gio::File>, Q: IsA<gio::File>, R: IsA<gio::Cancellable>>(&self, commit_checksum: &str, keyringdir: Option<&P>, extra_keyring: Option<&Q>, cancellable: Option<&R>) -> Result<GpgVerifyResult, glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let ret = ffi::ostree_repo_verify_commit_ext(self.to_glib_none().0, commit_checksum.to_glib_none().0, keyringdir.map(|p| p.as_ref()).to_glib_none().0, extra_keyring.map(|p| p.as_ref()).to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ pub fn verify_commit_ext(
+ &self,
+ commit_checksum: &str,
+ keyringdir: Option<&impl IsA<gio::File>>,
+ extra_keyring: Option<&impl IsA<gio::File>>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<GpgVerifyResult, glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let ret = ffi::ostree_repo_verify_commit_ext(
+ self.to_glib_none().0,
+ commit_checksum.to_glib_none().0,
+ keyringdir.map(|p| p.as_ref()).to_glib_none().0,
+ extra_keyring.map(|p| p.as_ref()).to_glib_none().0,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2016_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_14")))]
#[doc(alias = "ostree_repo_verify_commit_for_remote")]
- pub fn verify_commit_for_remote<P: IsA<gio::Cancellable>>(&self, commit_checksum: &str, remote_name: &str, cancellable: Option<&P>) -> Result<GpgVerifyResult, glib::Error> {
+ pub fn verify_commit_for_remote(
+ &self,
+ commit_checksum: &str,
+ remote_name: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<GpgVerifyResult, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let ret = ffi::ostree_repo_verify_commit_for_remote(self.to_glib_none().0, commit_checksum.to_glib_none().0, remote_name.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ let ret = ffi::ostree_repo_verify_commit_for_remote(
+ self.to_glib_none().0,
+ commit_checksum.to_glib_none().0,
+ remote_name.to_glib_none().0,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_verify_summary")]
- pub fn verify_summary<P: IsA<gio::Cancellable>>(&self, remote_name: &str, summary: &glib::Bytes, signatures: &glib::Bytes, cancellable: Option<&P>) -> Result<GpgVerifyResult, glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let ret = ffi::ostree_repo_verify_summary(self.to_glib_none().0, remote_name.to_glib_none().0, summary.to_glib_none().0, signatures.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ pub fn verify_summary(
+ &self,
+ remote_name: &str,
+ summary: &glib::Bytes,
+ signatures: &glib::Bytes,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<GpgVerifyResult, glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let ret = ffi::ostree_repo_verify_summary(
+ self.to_glib_none().0,
+ remote_name.to_glib_none().0,
+ summary.to_glib_none().0,
+ signatures.to_glib_none().0,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_write_archive_to_mtree")]
- pub fn write_archive_to_mtree<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(&self, archive: &P, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, autocreate_parents: bool, cancellable: Option<&Q>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_write_archive_to_mtree(self.to_glib_none().0, archive.as_ref().to_glib_none().0, mtree.to_glib_none().0, modifier.to_glib_none().0, autocreate_parents.into_glib(), 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_archive_to_mtree(
+ &self,
+ archive: &impl IsA<gio::File>,
+ mtree: &MutableTree,
+ modifier: Option<&RepoCommitModifier>,
+ autocreate_parents: bool,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_write_archive_to_mtree(
+ self.to_glib_none().0,
+ archive.as_ref().to_glib_none().0,
+ mtree.to_glib_none().0,
+ modifier.to_glib_none().0,
+ autocreate_parents.into_glib(),
+ 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_repo_write_archive_to_mtree_from_fd")]
- pub fn write_archive_to_mtree_from_fd<P: IsA<gio::Cancellable>>(&self, fd: i32, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, autocreate_parents: bool, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_write_archive_to_mtree_from_fd(self.to_glib_none().0, fd, mtree.to_glib_none().0, modifier.to_glib_none().0, autocreate_parents.into_glib(), 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_archive_to_mtree_from_fd(
+ &self,
+ fd: i32,
+ mtree: &MutableTree,
+ modifier: Option<&RepoCommitModifier>,
+ autocreate_parents: bool,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_write_archive_to_mtree_from_fd(
+ self.to_glib_none().0,
+ fd,
+ mtree.to_glib_none().0,
+ modifier.to_glib_none().0,
+ autocreate_parents.into_glib(),
+ 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_repo_write_commit")]
- pub fn write_commit<P: IsA<gio::Cancellable>>(&self, parent: Option<&str>, subject: Option<&str>, body: Option<&str>, metadata: Option<&glib::Variant>, root: &RepoFile, cancellable: Option<&P>) -> Result<glib::GString, glib::Error> {
+ pub fn write_commit(
+ &self,
+ parent: Option<&str>,
+ subject: Option<&str>,
+ body: Option<&str>,
+ metadata: Option<&glib::Variant>,
+ root: &RepoFile,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<glib::GString, glib::Error> {
unsafe {
let mut out_commit = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_write_commit(self.to_glib_none().0, parent.to_glib_none().0, subject.to_glib_none().0, body.to_glib_none().0, metadata.to_glib_none().0, root.to_glib_none().0, &mut out_commit, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_commit)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_write_commit(
+ self.to_glib_none().0,
+ parent.to_glib_none().0,
+ subject.to_glib_none().0,
+ body.to_glib_none().0,
+ metadata.to_glib_none().0,
+ root.to_glib_none().0,
+ &mut out_commit,
+ 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(from_glib_full(out_commit))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_write_commit_detached_metadata")]
- pub fn write_commit_detached_metadata<P: IsA<gio::Cancellable>>(&self, checksum: &str, metadata: Option<&glib::Variant>, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_write_commit_detached_metadata(self.to_glib_none().0, checksum.to_glib_none().0, metadata.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_commit_detached_metadata(
+ &self,
+ checksum: &str,
+ metadata: Option<&glib::Variant>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_write_commit_detached_metadata(
+ self.to_glib_none().0,
+ checksum.to_glib_none().0,
+ metadata.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_repo_write_commit_with_time")]
- pub fn write_commit_with_time<P: IsA<gio::Cancellable>>(&self, parent: Option<&str>, subject: Option<&str>, body: Option<&str>, metadata: Option<&glib::Variant>, root: &RepoFile, time: u64, cancellable: Option<&P>) -> Result<glib::GString, glib::Error> {
+ pub fn write_commit_with_time(
+ &self,
+ parent: Option<&str>,
+ subject: Option<&str>,
+ body: Option<&str>,
+ metadata: Option<&glib::Variant>,
+ root: &RepoFile,
+ time: u64,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<glib::GString, glib::Error> {
unsafe {
let mut out_commit = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_write_commit_with_time(self.to_glib_none().0, parent.to_glib_none().0, subject.to_glib_none().0, body.to_glib_none().0, metadata.to_glib_none().0, root.to_glib_none().0, time, &mut out_commit, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_commit)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_write_commit_with_time(
+ self.to_glib_none().0,
+ parent.to_glib_none().0,
+ subject.to_glib_none().0,
+ body.to_glib_none().0,
+ metadata.to_glib_none().0,
+ root.to_glib_none().0,
+ time,
+ &mut out_commit,
+ 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(from_glib_full(out_commit))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -1141,126 +2376,319 @@ impl Repo {
pub fn write_config(&self, new_config: &glib::KeyFile) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_write_config(self.to_glib_none().0, new_config.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_write_config(
+ self.to_glib_none().0,
+ new_config.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_repo_write_content_trusted")]
- pub fn write_content_trusted<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(&self, checksum: &str, object_input: &P, length: u64, cancellable: Option<&Q>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_write_content_trusted(self.to_glib_none().0, checksum.to_glib_none().0, object_input.as_ref().to_glib_none().0, length, 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_content_trusted(
+ &self,
+ checksum: &str,
+ object_input: &impl IsA<gio::InputStream>,
+ length: u64,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_write_content_trusted(
+ self.to_glib_none().0,
+ checksum.to_glib_none().0,
+ object_input.as_ref().to_glib_none().0,
+ length,
+ 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_repo_write_dfd_to_mtree")]
- pub fn write_dfd_to_mtree<P: IsA<gio::Cancellable>>(&self, dfd: i32, path: &str, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_write_dfd_to_mtree(self.to_glib_none().0, dfd, path.to_glib_none().0, mtree.to_glib_none().0, modifier.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_dfd_to_mtree(
+ &self,
+ dfd: i32,
+ path: &str,
+ mtree: &MutableTree,
+ modifier: Option<&RepoCommitModifier>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_write_dfd_to_mtree(
+ self.to_glib_none().0,
+ dfd,
+ path.to_glib_none().0,
+ mtree.to_glib_none().0,
+ modifier.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_repo_write_directory_to_mtree")]
- pub fn write_directory_to_mtree<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(&self, dir: &P, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, cancellable: Option<&Q>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_write_directory_to_mtree(self.to_glib_none().0, dir.as_ref().to_glib_none().0, mtree.to_glib_none().0, modifier.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_directory_to_mtree(
+ &self,
+ dir: &impl IsA<gio::File>,
+ mtree: &MutableTree,
+ modifier: Option<&RepoCommitModifier>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_write_directory_to_mtree(
+ self.to_glib_none().0,
+ dir.as_ref().to_glib_none().0,
+ mtree.to_glib_none().0,
+ modifier.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_repo_write_metadata_stream_trusted")]
- pub fn write_metadata_stream_trusted<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(&self, objtype: ObjectType, checksum: &str, object_input: &P, length: u64, cancellable: Option<&Q>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_write_metadata_stream_trusted(self.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, object_input.as_ref().to_glib_none().0, length, 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_metadata_stream_trusted(
+ &self,
+ objtype: ObjectType,
+ checksum: &str,
+ object_input: &impl IsA<gio::InputStream>,
+ length: u64,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_write_metadata_stream_trusted(
+ self.to_glib_none().0,
+ objtype.into_glib(),
+ checksum.to_glib_none().0,
+ object_input.as_ref().to_glib_none().0,
+ length,
+ 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_repo_write_metadata_trusted")]
- pub fn write_metadata_trusted<P: IsA<gio::Cancellable>>(&self, objtype: ObjectType, checksum: &str, variant: &glib::Variant, cancellable: Option<&P>) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_write_metadata_trusted(self.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, variant.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_metadata_trusted(
+ &self,
+ objtype: ObjectType,
+ checksum: &str,
+ variant: &glib::Variant,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_write_metadata_trusted(
+ self.to_glib_none().0,
+ objtype.into_glib(),
+ checksum.to_glib_none().0,
+ variant.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_repo_write_mtree")]
- pub fn write_mtree<P: IsA<gio::Cancellable>>(&self, mtree: &MutableTree, cancellable: Option<&P>) -> Result<gio::File, glib::Error> {
+ pub fn write_mtree(
+ &self,
+ mtree: &MutableTree,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<gio::File, glib::Error> {
unsafe {
let mut out_file = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_write_mtree(self.to_glib_none().0, mtree.to_glib_none().0, &mut out_file, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_file)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_write_mtree(
+ self.to_glib_none().0,
+ mtree.to_glib_none().0,
+ &mut out_file,
+ 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(from_glib_full(out_file))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2021_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_2")))]
#[doc(alias = "ostree_repo_write_regfile")]
- pub fn write_regfile(&self, expected_checksum: Option<&str>, uid: u32, gid: u32, mode: u32, content_len: u64, xattrs: Option<&glib::Variant>) -> Result<ContentWriter, glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let ret = ffi::ostree_repo_write_regfile(self.to_glib_none().0, expected_checksum.to_glib_none().0, uid, gid, mode, content_len, xattrs.to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ pub fn write_regfile(
+ &self,
+ expected_checksum: Option<&str>,
+ uid: u32,
+ gid: u32,
+ mode: u32,
+ content_len: u64,
+ xattrs: Option<&glib::Variant>,
+ ) -> Result<ContentWriter, glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let ret = ffi::ostree_repo_write_regfile(
+ self.to_glib_none().0,
+ expected_checksum.to_glib_none().0,
+ uid,
+ gid,
+ mode,
+ content_len,
+ xattrs.to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2021_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_2")))]
#[doc(alias = "ostree_repo_write_regfile_inline")]
- pub fn write_regfile_inline<P: IsA<gio::Cancellable>>(&self, expected_checksum: Option<&str>, uid: u32, gid: u32, mode: u32, xattrs: Option<&glib::Variant>, buf: &[u8], cancellable: Option<&P>) -> Result<glib::GString, glib::Error> {
+ pub fn write_regfile_inline(
+ &self,
+ expected_checksum: Option<&str>,
+ uid: u32,
+ gid: u32,
+ mode: u32,
+ xattrs: Option<&glib::Variant>,
+ buf: &[u8],
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<glib::GString, glib::Error> {
let len = buf.len() as usize;
unsafe {
let mut error = ptr::null_mut();
- let ret = ffi::ostree_repo_write_regfile_inline(self.to_glib_none().0, expected_checksum.to_glib_none().0, uid, gid, mode, xattrs.to_glib_none().0, buf.to_glib_none().0, len, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ let ret = ffi::ostree_repo_write_regfile_inline(
+ self.to_glib_none().0,
+ expected_checksum.to_glib_none().0,
+ uid,
+ gid,
+ mode,
+ xattrs.to_glib_none().0,
+ buf.to_glib_none().0,
+ len,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2021_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_2")))]
#[doc(alias = "ostree_repo_write_symlink")]
- pub fn write_symlink<P: IsA<gio::Cancellable>>(&self, expected_checksum: Option<&str>, uid: u32, gid: u32, xattrs: Option<&glib::Variant>, symlink_target: &str, cancellable: Option<&P>) -> Result<glib::GString, glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let ret = ffi::ostree_repo_write_symlink(self.to_glib_none().0, expected_checksum.to_glib_none().0, uid, gid, xattrs.to_glib_none().0, symlink_target.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ pub fn write_symlink(
+ &self,
+ expected_checksum: Option<&str>,
+ uid: u32,
+ gid: u32,
+ xattrs: Option<&glib::Variant>,
+ symlink_target: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<glib::GString, glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let ret = ffi::ostree_repo_write_symlink(
+ self.to_glib_none().0,
+ expected_checksum.to_glib_none().0,
+ uid,
+ gid,
+ xattrs.to_glib_none().0,
+ symlink_target.to_glib_none().0,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "remotes-config-dir")]
pub fn remotes_config_dir(&self) -> Option<glib::GString> {
- unsafe {
- let mut value = glib::Value::from_type(<glib::GString as StaticType>::static_type());
- glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"remotes-config-dir\0".as_ptr() as *const _, value.to_glib_none_mut().0);
- value.get().expect("Return Value for property `remotes-config-dir` getter")
- }
+ glib::ObjectExt::property(self, "remotes-config-dir")
}
#[doc(alias = "sysroot-path")]
pub fn sysroot_path(&self) -> Option<gio::File> {
- unsafe {
- let mut value = glib::Value::from_type(<gio::File as StaticType>::static_type());
- glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"sysroot-path\0".as_ptr() as *const _, value.to_glib_none_mut().0);
- value.get().expect("Return Value for property `sysroot-path` getter")
- }
+ glib::ObjectExt::property(self, "sysroot-path")
}
#[cfg(any(feature = "v2017_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))]
#[doc(alias = "ostree_repo_create_at")]
- pub fn create_at<P: IsA<gio::Cancellable>>(dfd: i32, path: &str, mode: RepoMode, options: Option<&glib::Variant>, cancellable: Option<&P>) -> Result<Repo, glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let ret = ffi::ostree_repo_create_at(dfd, path.to_glib_none().0, mode.into_glib(), options.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ pub fn create_at(
+ dfd: i32,
+ path: &str,
+ mode: RepoMode,
+ options: Option<&glib::Variant>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<Repo, glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let ret = ffi::ostree_repo_create_at(
+ dfd,
+ path.to_glib_none().0,
+ mode.into_glib(),
+ options.to_glib_none().0,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -1269,20 +2697,42 @@ impl Repo {
unsafe {
let mut out_mode = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_mode_from_string(mode.to_glib_none().0, out_mode.as_mut_ptr(), &mut error);
+ let is_ok = ffi::ostree_repo_mode_from_string(
+ mode.to_glib_none().0,
+ out_mode.as_mut_ptr(),
+ &mut error,
+ );
let out_mode = out_mode.assume_init();
- if error.is_null() { Ok(from_glib(out_mode)) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib(out_mode))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2017_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))]
#[doc(alias = "ostree_repo_open_at")]
- pub fn open_at<P: IsA<gio::Cancellable>>(dfd: i32, path: &str, cancellable: Option<&P>) -> Result<Repo, glib::Error> {
+ pub fn open_at(
+ dfd: i32,
+ path: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<Repo, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let ret = ffi::ostree_repo_open_at(dfd, path.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ let ret = ffi::ostree_repo_open_at(
+ dfd,
+ path.to_glib_none().0,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -1311,15 +2761,35 @@ impl Repo {
//}
#[doc(alias = "gpg-verify-result")]
- pub fn connect_gpg_verify_result<F: Fn(&Self, &str, &GpgVerifyResult) + Send + 'static>(&self, f: F) -> SignalHandlerId {
- unsafe extern "C" fn gpg_verify_result_trampoline<F: Fn(&Repo, &str, &GpgVerifyResult) + Send + 'static>(this: *mut ffi::OstreeRepo, checksum: *mut libc::c_char, result: *mut ffi::OstreeGpgVerifyResult, f: glib::ffi::gpointer) {
+ pub fn connect_gpg_verify_result<F: Fn(&Self, &str, &GpgVerifyResult) + Send + 'static>(
+ &self,
+ f: F,
+ ) -> SignalHandlerId {
+ unsafe extern "C" fn gpg_verify_result_trampoline<
+ F: Fn(&Repo, &str, &GpgVerifyResult) + Send + 'static,
+ >(
+ this: *mut ffi::OstreeRepo,
+ checksum: *mut libc::c_char,
+ result: *mut ffi::OstreeGpgVerifyResult,
+ f: glib::ffi::gpointer,
+ ) {
let f: &F = &*(f as *const F);
- f(&from_glib_borrow(this), &glib::GString::from_glib_borrow(checksum), &from_glib_borrow(result))
+ f(
+ &from_glib_borrow(this),
+ &glib::GString::from_glib_borrow(checksum),
+ &from_glib_borrow(result),
+ )
}
unsafe {
let f: Box_<F> = Box_::new(f);
- connect_raw(self.as_ptr() as *mut _, b"gpg-verify-result\0".as_ptr() as *const _,
- Some(transmute::<_, unsafe extern "C" fn()>(gpg_verify_result_trampoline::<F> as *const ())), Box_::into_raw(f))
+ connect_raw(
+ self.as_ptr() as *mut _,
+ b"gpg-verify-result\0".as_ptr() as *const _,
+ Some(transmute::<_, unsafe extern "C" fn()>(
+ gpg_verify_result_trampoline::<F> as *const (),
+ )),
+ Box_::into_raw(f),
+ )
}
}
}
diff --git a/rust-bindings/src/auto/repo_commit_modifier.rs b/rust-bindings/src/auto/repo_commit_modifier.rs
index eea16a82..75504434 100644
--- a/rust-bindings/src/auto/repo_commit_modifier.rs
+++ b/rust-bindings/src/auto/repo_commit_modifier.rs
@@ -31,13 +31,27 @@ glib::wrapper! {
impl RepoCommitModifier {
#[doc(alias = "ostree_repo_commit_modifier_new")]
- pub fn new(flags: RepoCommitModifierFlags, commit_filter: Option<Box_<dyn Fn(&Repo, &str, &gio::FileInfo) -> RepoCommitFilterResult + 'static>>) -> RepoCommitModifier {
- let commit_filter_data: Box_<Option<Box_<dyn Fn(&Repo, &str, &gio::FileInfo) -> RepoCommitFilterResult + 'static>>> = Box_::new(commit_filter);
- unsafe extern "C" fn commit_filter_func(repo: *mut ffi::OstreeRepo, path: *const libc::c_char, file_info: *mut gio::ffi::GFileInfo, user_data: glib::ffi::gpointer) -> ffi::OstreeRepoCommitFilterResult {
+ pub fn new(
+ flags: RepoCommitModifierFlags,
+ commit_filter: Option<
+ Box_<dyn Fn(&Repo, &str, &gio::FileInfo) -> RepoCommitFilterResult + 'static>,
+ >,
+ ) -> RepoCommitModifier {
+ let commit_filter_data: Box_<
+ Option<Box_<dyn Fn(&Repo, &str, &gio::FileInfo) -> RepoCommitFilterResult + 'static>>,
+ > = Box_::new(commit_filter);
+ unsafe extern "C" fn commit_filter_func(
+ repo: *mut ffi::OstreeRepo,
+ path: *const libc::c_char,
+ file_info: *mut gio::ffi::GFileInfo,
+ user_data: glib::ffi::gpointer,
+ ) -> ffi::OstreeRepoCommitFilterResult {
let repo = from_glib_borrow(repo);
let path: Borrowed<glib::GString> = from_glib_borrow(path);
let file_info = from_glib_borrow(file_info);
- let callback: &Option<Box_<dyn Fn(&Repo, &str, &gio::FileInfo) -> RepoCommitFilterResult + 'static>> = &*(user_data as *mut _);
+ let callback: &Option<
+ Box_<dyn Fn(&Repo, &str, &gio::FileInfo) -> RepoCommitFilterResult + 'static>,
+ > = &*(user_data as *mut _);
let res = if let Some(ref callback) = *callback {
callback(&repo, path.as_str(), &file_info)
} else {
@@ -45,14 +59,29 @@ impl RepoCommitModifier {
};
res.into_glib()
}
- let commit_filter = if commit_filter_data.is_some() { Some(commit_filter_func as _) } else { None };
+ let commit_filter = if commit_filter_data.is_some() {
+ Some(commit_filter_func as _)
+ } else {
+ None
+ };
unsafe extern "C" fn destroy_notify_func(data: glib::ffi::gpointer) {
- let _callback: Box_<Option<Box_<dyn Fn(&Repo, &str, &gio::FileInfo) -> RepoCommitFilterResult + 'static>>> = Box_::from_raw(data as *mut _);
+ let _callback: Box_<
+ Option<
+ Box_<dyn Fn(&Repo, &str, &gio::FileInfo) -> RepoCommitFilterResult + 'static>,
+ >,
+ > = Box_::from_raw(data as *mut _);
}
let destroy_call3 = Some(destroy_notify_func as _);
- let super_callback0: Box_<Option<Box_<dyn Fn(&Repo, &str, &gio::FileInfo) -> RepoCommitFilterResult + 'static>>> = commit_filter_data;
+ let super_callback0: Box_<
+ Option<Box_<dyn Fn(&Repo, &str, &gio::FileInfo) -> RepoCommitFilterResult + 'static>>,
+ > = commit_filter_data;
unsafe {
- from_glib_full(ffi::ostree_repo_commit_modifier_new(flags.into_glib(), commit_filter, Box_::into_raw(super_callback0) as *mut _, destroy_call3))
+ from_glib_full(ffi::ostree_repo_commit_modifier_new(
+ flags.into_glib(),
+ commit_filter,
+ Box_::into_raw(super_callback0) as *mut _,
+ destroy_call3,
+ ))
}
}
@@ -61,32 +90,64 @@ impl RepoCommitModifier {
#[doc(alias = "ostree_repo_commit_modifier_set_devino_cache")]
pub fn set_devino_cache(&self, cache: &RepoDevInoCache) {
unsafe {
- ffi::ostree_repo_commit_modifier_set_devino_cache(self.to_glib_none().0, cache.to_glib_none().0);
+ ffi::ostree_repo_commit_modifier_set_devino_cache(
+ self.to_glib_none().0,
+ cache.to_glib_none().0,
+ );
}
}
#[doc(alias = "ostree_repo_commit_modifier_set_sepolicy")]
pub fn set_sepolicy(&self, sepolicy: Option<&SePolicy>) {
unsafe {
- ffi::ostree_repo_commit_modifier_set_sepolicy(self.to_glib_none().0, sepolicy.to_glib_none().0);
+ ffi::ostree_repo_commit_modifier_set_sepolicy(
+ self.to_glib_none().0,
+ sepolicy.to_glib_none().0,
+ );
}
}
#[cfg(any(feature = "v2020_4", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_4")))]
#[doc(alias = "ostree_repo_commit_modifier_set_sepolicy_from_commit")]
- pub fn set_sepolicy_from_commit<P: IsA<gio::Cancellable>>(&self, repo: &Repo, rev: &str, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn set_sepolicy_from_commit(
+ &self,
+ repo: &Repo,
+ rev: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_commit_modifier_set_sepolicy_from_commit(self.to_glib_none().0, repo.to_glib_none().0, rev.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)) }
+ let is_ok = ffi::ostree_repo_commit_modifier_set_sepolicy_from_commit(
+ self.to_glib_none().0,
+ repo.to_glib_none().0,
+ rev.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_repo_commit_modifier_set_xattr_callback")]
- pub fn set_xattr_callback<P: Fn(&Repo, &str, &gio::FileInfo) -> glib::Variant + 'static>(&self, callback: P) {
+ pub fn set_xattr_callback<P: Fn(&Repo, &str, &gio::FileInfo) -> glib::Variant + 'static>(
+ &self,
+ callback: P,
+ ) {
let callback_data: Box_<P> = Box_::new(callback);
- unsafe extern "C" fn callback_func<P: Fn(&Repo, &str, &gio::FileInfo) -> glib::Variant + 'static>(repo: *mut ffi::OstreeRepo, path: *const libc::c_char, file_info: *mut gio::ffi::GFileInfo, user_data: glib::ffi::gpointer) -> *mut glib::ffi::GVariant {
+ unsafe extern "C" fn callback_func<
+ P: Fn(&Repo, &str, &gio::FileInfo) -> glib::Variant + 'static,
+ >(
+ repo: *mut ffi::OstreeRepo,
+ path: *const libc::c_char,
+ file_info: *mut gio::ffi::GFileInfo,
+ user_data: glib::ffi::gpointer,
+ ) -> *mut glib::ffi::GVariant {
let repo = from_glib_borrow(repo);
let path: Borrowed<glib::GString> = from_glib_borrow(path);
let file_info = from_glib_borrow(file_info);
@@ -95,13 +156,22 @@ impl RepoCommitModifier {
res.to_glib_full()
}
let callback = Some(callback_func::<P> as _);
- unsafe extern "C" fn destroy_func<P: Fn(&Repo, &str, &gio::FileInfo) -> glib::Variant + 'static>(data: glib::ffi::gpointer) {
+ unsafe extern "C" fn destroy_func<
+ P: Fn(&Repo, &str, &gio::FileInfo) -> glib::Variant + 'static,
+ >(
+ data: glib::ffi::gpointer,
+ ) {
let _callback: Box_<P> = Box_::from_raw(data as *mut _);
}
let destroy_call2 = Some(destroy_func::<P> as _);
let super_callback0: Box_<P> = callback_data;
unsafe {
- ffi::ostree_repo_commit_modifier_set_xattr_callback(self.to_glib_none().0, callback, destroy_call2, Box_::into_raw(super_callback0) as *mut _);
+ ffi::ostree_repo_commit_modifier_set_xattr_callback(
+ self.to_glib_none().0,
+ callback,
+ destroy_call2,
+ Box_::into_raw(super_callback0) as *mut _,
+ );
}
}
}
diff --git a/rust-bindings/src/auto/repo_dev_ino_cache.rs b/rust-bindings/src/auto/repo_dev_ino_cache.rs
index 1cc7cd43..fbba9189 100644
--- a/rust-bindings/src/auto/repo_dev_ino_cache.rs
+++ b/rust-bindings/src/auto/repo_dev_ino_cache.rs
@@ -18,9 +18,7 @@ glib::wrapper! {
impl RepoDevInoCache {
#[doc(alias = "ostree_repo_devino_cache_new")]
pub fn new() -> RepoDevInoCache {
- unsafe {
- from_glib_full(ffi::ostree_repo_devino_cache_new())
- }
+ unsafe { from_glib_full(ffi::ostree_repo_devino_cache_new()) }
}
}
diff --git a/rust-bindings/src/auto/repo_file.rs b/rust-bindings/src/auto/repo_file.rs
index 07c17ee7..29796933 100644
--- a/rust-bindings/src/auto/repo_file.rs
+++ b/rust-bindings/src/auto/repo_file.rs
@@ -23,43 +23,56 @@ impl RepoFile {
pub fn ensure_resolved(&self) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_file_ensure_resolved(self.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_file_ensure_resolved(self.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_repo_file_get_checksum")]
#[doc(alias = "get_checksum")]
pub fn checksum(&self) -> Option<glib::GString> {
- unsafe {
- from_glib_none(ffi::ostree_repo_file_get_checksum(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_repo_file_get_checksum(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_repo_file_get_repo")]
#[doc(alias = "get_repo")]
pub fn repo(&self) -> Option<Repo> {
- unsafe {
- from_glib_none(ffi::ostree_repo_file_get_repo(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_repo_file_get_repo(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_repo_file_get_root")]
#[doc(alias = "get_root")]
+ #[must_use]
pub fn root(&self) -> Option<RepoFile> {
- unsafe {
- from_glib_none(ffi::ostree_repo_file_get_root(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_repo_file_get_root(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_repo_file_get_xattrs")]
#[doc(alias = "get_xattrs")]
- pub fn xattrs<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<glib::Variant, glib::Error> {
+ pub fn xattrs(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<glib::Variant, glib::Error> {
unsafe {
let mut out_xattrs = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_file_get_xattrs(self.to_glib_none().0, &mut out_xattrs, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_xattrs)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_file_get_xattrs(
+ self.to_glib_none().0,
+ &mut out_xattrs,
+ 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(from_glib_full(out_xattrs))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -68,7 +81,12 @@ impl RepoFile {
unsafe {
let mut is_dir = mem::MaybeUninit::uninit();
let mut out_container = ptr::null_mut();
- let ret = ffi::ostree_repo_file_tree_find_child(self.to_glib_none().0, name.to_glib_none().0, is_dir.as_mut_ptr(), &mut out_container);
+ let ret = ffi::ostree_repo_file_tree_find_child(
+ self.to_glib_none().0,
+ name.to_glib_none().0,
+ is_dir.as_mut_ptr(),
+ &mut out_container,
+ );
let is_dir = is_dir.assume_init();
(ret, from_glib(is_dir), from_glib_full(out_container))
}
@@ -77,45 +95,76 @@ impl RepoFile {
#[doc(alias = "ostree_repo_file_tree_get_contents")]
pub fn tree_get_contents(&self) -> Option<glib::Variant> {
unsafe {
- from_glib_full(ffi::ostree_repo_file_tree_get_contents(self.to_glib_none().0))
+ from_glib_full(ffi::ostree_repo_file_tree_get_contents(
+ self.to_glib_none().0,
+ ))
}
}
#[doc(alias = "ostree_repo_file_tree_get_contents_checksum")]
pub fn tree_get_contents_checksum(&self) -> Option<glib::GString> {
unsafe {
- from_glib_none(ffi::ostree_repo_file_tree_get_contents_checksum(self.to_glib_none().0))
+ from_glib_none(ffi::ostree_repo_file_tree_get_contents_checksum(
+ self.to_glib_none().0,
+ ))
}
}
#[doc(alias = "ostree_repo_file_tree_get_metadata")]
pub fn tree_get_metadata(&self) -> Option<glib::Variant> {
unsafe {
- from_glib_full(ffi::ostree_repo_file_tree_get_metadata(self.to_glib_none().0))
+ from_glib_full(ffi::ostree_repo_file_tree_get_metadata(
+ self.to_glib_none().0,
+ ))
}
}
#[doc(alias = "ostree_repo_file_tree_get_metadata_checksum")]
pub fn tree_get_metadata_checksum(&self) -> Option<glib::GString> {
unsafe {
- from_glib_none(ffi::ostree_repo_file_tree_get_metadata_checksum(self.to_glib_none().0))
+ from_glib_none(ffi::ostree_repo_file_tree_get_metadata_checksum(
+ self.to_glib_none().0,
+ ))
}
}
#[doc(alias = "ostree_repo_file_tree_query_child")]
- pub fn tree_query_child<P: IsA<gio::Cancellable>>(&self, n: i32, attributes: &str, flags: gio::FileQueryInfoFlags, cancellable: Option<&P>) -> Result<gio::FileInfo, glib::Error> {
+ pub fn tree_query_child(
+ &self,
+ n: i32,
+ attributes: &str,
+ flags: gio::FileQueryInfoFlags,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<gio::FileInfo, glib::Error> {
unsafe {
let mut out_info = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_file_tree_query_child(self.to_glib_none().0, n, attributes.to_glib_none().0, flags.into_glib(), &mut out_info, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_info)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_repo_file_tree_query_child(
+ self.to_glib_none().0,
+ n,
+ attributes.to_glib_none().0,
+ flags.into_glib(),
+ &mut out_info,
+ 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(from_glib_full(out_info))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_repo_file_tree_set_metadata")]
pub fn tree_set_metadata(&self, checksum: &str, metadata: &glib::Variant) {
unsafe {
- ffi::ostree_repo_file_tree_set_metadata(self.to_glib_none().0, checksum.to_glib_none().0, metadata.to_glib_none().0);
+ ffi::ostree_repo_file_tree_set_metadata(
+ self.to_glib_none().0,
+ checksum.to_glib_none().0,
+ metadata.to_glib_none().0,
+ );
}
}
}
diff --git a/rust-bindings/src/auto/repo_finder.rs b/rust-bindings/src/auto/repo_finder.rs
index ed5e1f86..1252c2be 100644
--- a/rust-bindings/src/auto/repo_finder.rs
+++ b/rust-bindings/src/auto/repo_finder.rs
@@ -2,10 +2,16 @@
// from gir-files
// DO NOT EDIT
+#[cfg(any(feature = "v2018_6", feature = "dox"))]
+#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
use crate::RepoFinderResult;
use glib::object::IsA;
+#[cfg(any(feature = "v2018_6", feature = "dox"))]
+#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
use glib::translate::*;
use std::fmt;
+#[cfg(any(feature = "v2018_6", feature = "dox"))]
+#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
use std::ptr;
glib::wrapper! {
@@ -17,9 +23,9 @@ glib::wrapper! {
}
}
-impl RepoFinder {}
-
-pub const NONE_REPO_FINDER: Option<&RepoFinder> = None;
+impl RepoFinder {
+ pub const NONE: Option<&'static RepoFinder> = None;
+}
pub trait RepoFinderExt: 'static {}
diff --git a/rust-bindings/src/auto/repo_finder_avahi.rs b/rust-bindings/src/auto/repo_finder_avahi.rs
index 8910a437..c86a3878 100644
--- a/rust-bindings/src/auto/repo_finder_avahi.rs
+++ b/rust-bindings/src/auto/repo_finder_avahi.rs
@@ -3,9 +3,10 @@
// DO NOT EDIT
use crate::RepoFinder;
+#[cfg(any(feature = "v2018_6", feature = "dox"))]
+#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
use glib::translate::*;
use std::fmt;
-use std::ptr;
glib::wrapper! {
#[doc(alias = "OstreeRepoFinderAvahi")]
@@ -17,22 +18,15 @@ glib::wrapper! {
}
impl RepoFinderAvahi {
+ #[cfg(any(feature = "v2018_6", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
#[doc(alias = "ostree_repo_finder_avahi_new")]
pub fn new(context: Option<&glib::MainContext>) -> RepoFinderAvahi {
- unsafe {
- from_glib_full(ffi::ostree_repo_finder_avahi_new(context.to_glib_none().0))
- }
- }
-
- #[doc(alias = "ostree_repo_finder_avahi_start")]
- pub fn start(&self) -> Result<(), glib::Error> {
- unsafe {
- let mut error = ptr::null_mut();
- let _ = ffi::ostree_repo_finder_avahi_start(self.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
- }
+ unsafe { from_glib_full(ffi::ostree_repo_finder_avahi_new(context.to_glib_none().0)) }
}
+ #[cfg(any(feature = "v2018_6", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
#[doc(alias = "ostree_repo_finder_avahi_stop")]
pub fn stop(&self) {
unsafe {
diff --git a/rust-bindings/src/auto/repo_finder_config.rs b/rust-bindings/src/auto/repo_finder_config.rs
index 2b76d99b..74c6c035 100644
--- a/rust-bindings/src/auto/repo_finder_config.rs
+++ b/rust-bindings/src/auto/repo_finder_config.rs
@@ -3,6 +3,8 @@
// DO NOT EDIT
use crate::RepoFinder;
+#[cfg(any(feature = "v2018_6", feature = "dox"))]
+#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
use glib::translate::*;
use std::fmt;
@@ -16,11 +18,11 @@ glib::wrapper! {
}
impl RepoFinderConfig {
+ #[cfg(any(feature = "v2018_6", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
#[doc(alias = "ostree_repo_finder_config_new")]
pub fn new() -> RepoFinderConfig {
- unsafe {
- from_glib_full(ffi::ostree_repo_finder_config_new())
- }
+ unsafe { from_glib_full(ffi::ostree_repo_finder_config_new()) }
}
}
diff --git a/rust-bindings/src/auto/repo_finder_mount.rs b/rust-bindings/src/auto/repo_finder_mount.rs
index eda91f38..b34713b6 100644
--- a/rust-bindings/src/auto/repo_finder_mount.rs
+++ b/rust-bindings/src/auto/repo_finder_mount.rs
@@ -3,9 +3,17 @@
// DO NOT EDIT
use crate::RepoFinder;
+#[cfg(any(feature = "v2018_6", feature = "dox"))]
+#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
use glib::object::IsA;
+#[cfg(any(feature = "v2018_6", feature = "dox"))]
+#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
use glib::object::ObjectType as ObjectType_;
+#[cfg(any(feature = "v2018_6", feature = "dox"))]
+#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
use glib::translate::*;
+#[cfg(any(feature = "v2018_6", feature = "dox"))]
+#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
use glib::StaticType;
use std::fmt;
@@ -19,21 +27,21 @@ glib::wrapper! {
}
impl RepoFinderMount {
+ #[cfg(any(feature = "v2018_6", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
#[doc(alias = "ostree_repo_finder_mount_new")]
- pub fn new<P: IsA<gio::VolumeMonitor>>(monitor: Option<&P>) -> RepoFinderMount {
+ pub fn new(monitor: Option<&impl IsA<gio::VolumeMonitor>>) -> RepoFinderMount {
unsafe {
- from_glib_full(ffi::ostree_repo_finder_mount_new(monitor.map(|p| p.as_ref()).to_glib_none().0))
+ from_glib_full(ffi::ostree_repo_finder_mount_new(
+ monitor.map(|p| p.as_ref()).to_glib_none().0,
+ ))
}
}
#[cfg(any(feature = "v2018_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
pub fn monitor(&self) -> Option<gio::VolumeMonitor> {
- unsafe {
- let mut value = glib::Value::from_type(<gio::VolumeMonitor as StaticType>::static_type());
- glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"monitor\0".as_ptr() as *const _, value.to_glib_none_mut().0);
- value.get().expect("Return Value for property `monitor` getter")
- }
+ glib::ObjectExt::property(self, "monitor")
}
}
diff --git a/rust-bindings/src/auto/repo_finder_override.rs b/rust-bindings/src/auto/repo_finder_override.rs
index d504c180..1c1522b9 100644
--- a/rust-bindings/src/auto/repo_finder_override.rs
+++ b/rust-bindings/src/auto/repo_finder_override.rs
@@ -3,6 +3,8 @@
// DO NOT EDIT
use crate::RepoFinder;
+#[cfg(any(feature = "v2018_6", feature = "dox"))]
+#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
use glib::translate::*;
use std::fmt;
@@ -16,13 +18,15 @@ glib::wrapper! {
}
impl RepoFinderOverride {
+ #[cfg(any(feature = "v2018_6", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
#[doc(alias = "ostree_repo_finder_override_new")]
pub fn new() -> RepoFinderOverride {
- unsafe {
- from_glib_full(ffi::ostree_repo_finder_override_new())
- }
+ unsafe { from_glib_full(ffi::ostree_repo_finder_override_new()) }
}
+ #[cfg(any(feature = "v2018_6", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
#[doc(alias = "ostree_repo_finder_override_add_uri")]
pub fn add_uri(&self, uri: &str) {
unsafe {
diff --git a/rust-bindings/src/auto/repo_finder_result.rs b/rust-bindings/src/auto/repo_finder_result.rs
index 702ec52c..80bf2575 100644
--- a/rust-bindings/src/auto/repo_finder_result.rs
+++ b/rust-bindings/src/auto/repo_finder_result.rs
@@ -18,15 +18,13 @@ glib::wrapper! {
impl RepoFinderResult {
//#[doc(alias = "ostree_repo_finder_result_new")]
- //pub fn new<P: IsA<RepoFinder>>(remote: &Remote, finder: &P, priority: i32, ref_to_checksum: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 28 }, ref_to_timestamp: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 9 }, summary_last_modified: u64) -> RepoFinderResult {
+ //pub fn new(remote: &Remote, finder: &impl IsA<RepoFinder>, priority: i32, ref_to_checksum: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 28 }, ref_to_timestamp: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 9 }, summary_last_modified: u64) -> RepoFinderResult {
// unsafe { TODO: call ffi:ostree_repo_finder_result_new() }
//}
#[doc(alias = "ostree_repo_finder_result_compare")]
fn compare(&self, b: &RepoFinderResult) -> i32 {
- unsafe {
- ffi::ostree_repo_finder_result_compare(self.to_glib_none().0, b.to_glib_none().0)
- }
+ unsafe { ffi::ostree_repo_finder_result_compare(self.to_glib_none().0, b.to_glib_none().0) }
}
}
diff --git a/rust-bindings/src/auto/se_policy.rs b/rust-bindings/src/auto/se_policy.rs
index 91148ac7..99590929 100644
--- a/rust-bindings/src/auto/se_policy.rs
+++ b/rust-bindings/src/auto/se_policy.rs
@@ -22,32 +22,67 @@ glib::wrapper! {
impl SePolicy {
#[doc(alias = "ostree_sepolicy_new")]
- pub fn new<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(path: &P, cancellable: Option<&Q>) -> Result<SePolicy, glib::Error> {
+ pub fn new(
+ path: &impl IsA<gio::File>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<SePolicy, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let ret = ffi::ostree_sepolicy_new(path.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ let ret = ffi::ostree_sepolicy_new(
+ path.as_ref().to_glib_none().0,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2017_4", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_4")))]
#[doc(alias = "ostree_sepolicy_new_at")]
- pub fn new_at<P: IsA<gio::Cancellable>>(rootfs_dfd: i32, cancellable: Option<&P>) -> Result<SePolicy, glib::Error> {
+ pub fn new_at(
+ rootfs_dfd: i32,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<SePolicy, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let ret = ffi::ostree_sepolicy_new_at(rootfs_dfd, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ let ret = ffi::ostree_sepolicy_new_at(
+ rootfs_dfd,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_sepolicy_new_from_commit")]
#[doc(alias = "new_from_commit")]
- pub fn from_commit<P: IsA<gio::Cancellable>>(repo: &Repo, rev: &str, cancellable: Option<&P>) -> Result<SePolicy, glib::Error> {
+ pub fn from_commit(
+ repo: &Repo,
+ rev: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<SePolicy, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let ret = ffi::ostree_sepolicy_new_from_commit(repo.to_glib_none().0, rev.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ let ret = ffi::ostree_sepolicy_new_from_commit(
+ repo.to_glib_none().0,
+ rev.to_glib_none().0,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -56,45 +91,77 @@ impl SePolicy {
#[doc(alias = "ostree_sepolicy_get_csum")]
#[doc(alias = "get_csum")]
pub fn csum(&self) -> Option<glib::GString> {
- unsafe {
- from_glib_none(ffi::ostree_sepolicy_get_csum(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_sepolicy_get_csum(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_sepolicy_get_label")]
#[doc(alias = "get_label")]
- pub fn label<P: IsA<gio::Cancellable>>(&self, relpath: &str, unix_mode: u32, cancellable: Option<&P>) -> Result<glib::GString, glib::Error> {
+ pub fn label(
+ &self,
+ relpath: &str,
+ unix_mode: u32,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<glib::GString, glib::Error> {
unsafe {
let mut out_label = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sepolicy_get_label(self.to_glib_none().0, relpath.to_glib_none().0, unix_mode, &mut out_label, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_label)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sepolicy_get_label(
+ self.to_glib_none().0,
+ relpath.to_glib_none().0,
+ unix_mode,
+ &mut out_label,
+ 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(from_glib_full(out_label))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_sepolicy_get_name")]
#[doc(alias = "get_name")]
pub fn name(&self) -> Option<glib::GString> {
- unsafe {
- from_glib_none(ffi::ostree_sepolicy_get_name(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_sepolicy_get_name(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_sepolicy_get_path")]
#[doc(alias = "get_path")]
pub fn path(&self) -> Option<gio::File> {
- unsafe {
- from_glib_none(ffi::ostree_sepolicy_get_path(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_sepolicy_get_path(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_sepolicy_restorecon")]
- pub fn restorecon<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(&self, path: &str, info: Option<&gio::FileInfo>, target: &P, flags: SePolicyRestoreconFlags, cancellable: Option<&Q>) -> Result<glib::GString, glib::Error> {
+ pub fn restorecon(
+ &self,
+ path: &str,
+ info: Option<&gio::FileInfo>,
+ target: &impl IsA<gio::File>,
+ flags: SePolicyRestoreconFlags,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<glib::GString, glib::Error> {
unsafe {
let mut out_new_label = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sepolicy_restorecon(self.to_glib_none().0, path.to_glib_none().0, info.to_glib_none().0, target.as_ref().to_glib_none().0, flags.into_glib(), &mut out_new_label, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_new_label)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sepolicy_restorecon(
+ self.to_glib_none().0,
+ path.to_glib_none().0,
+ info.to_glib_none().0,
+ target.as_ref().to_glib_none().0,
+ flags.into_glib(),
+ &mut out_new_label,
+ 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(from_glib_full(out_new_label))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -102,18 +169,24 @@ impl SePolicy {
pub fn setfscreatecon(&self, path: &str, mode: u32) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sepolicy_setfscreatecon(self.to_glib_none().0, path.to_glib_none().0, mode, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sepolicy_setfscreatecon(
+ self.to_glib_none().0,
+ path.to_glib_none().0,
+ mode,
+ &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 = "rootfs-dfd")]
pub fn rootfs_dfd(&self) -> i32 {
- unsafe {
- let mut value = glib::Value::from_type(<i32 as StaticType>::static_type());
- glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"rootfs-dfd\0".as_ptr() as *const _, value.to_glib_none_mut().0);
- value.get().expect("Return Value for property `rootfs-dfd` getter")
- }
+ glib::ObjectExt::property(self, "rootfs-dfd")
}
}
diff --git a/rust-bindings/src/auto/sign.rs b/rust-bindings/src/auto/sign.rs
index 7a449245..577697c9 100644
--- a/rust-bindings/src/auto/sign.rs
+++ b/rust-bindings/src/auto/sign.rs
@@ -2,10 +2,16 @@
// from gir-files
// DO NOT EDIT
+#[cfg(any(feature = "v2020_2", feature = "dox"))]
+#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
use crate::Repo;
use glib::object::IsA;
+#[cfg(any(feature = "v2020_2", feature = "dox"))]
+#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
use glib::translate::*;
use std::fmt;
+#[cfg(any(feature = "v2020_2", feature = "dox"))]
+#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
use std::ptr;
glib::wrapper! {
@@ -18,168 +24,371 @@ glib::wrapper! {
}
impl Sign {
+ pub const NONE: Option<&'static Sign> = None;
+
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_get_all")]
#[doc(alias = "get_all")]
pub fn all() -> Vec<Sign> {
- unsafe {
- FromGlibPtrContainer::from_glib_full(ffi::ostree_sign_get_all())
- }
+ unsafe { FromGlibPtrContainer::from_glib_full(ffi::ostree_sign_get_all()) }
}
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_get_by_name")]
#[doc(alias = "get_by_name")]
pub fn by_name(name: &str) -> Result<Sign, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let ret = ffi::ostree_sign_get_by_name(name.to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
}
-pub const NONE_SIGN: Option<&Sign> = None;
-
pub trait SignExt: 'static {
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_add_pk")]
fn add_pk(&self, public_key: &glib::Variant) -> Result<(), glib::Error>;
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_clear_keys")]
fn clear_keys(&self) -> Result<(), glib::Error>;
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_commit")]
- fn commit<P: IsA<gio::Cancellable>>(&self, repo: &Repo, commit_checksum: &str, cancellable: Option<&P>) -> Result<(), glib::Error>;
-
+ fn commit(
+ &self,
+ repo: &Repo,
+ commit_checksum: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error>;
+
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_commit_verify")]
- fn commit_verify<P: IsA<gio::Cancellable>>(&self, repo: &Repo, commit_checksum: &str, cancellable: Option<&P>) -> Result<Option<glib::GString>, glib::Error>;
-
+ fn commit_verify(
+ &self,
+ repo: &Repo,
+ commit_checksum: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<Option<glib::GString>, glib::Error>;
+
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_data")]
- fn data<P: IsA<gio::Cancellable>>(&self, data: &glib::Bytes, cancellable: Option<&P>) -> Result<glib::Bytes, glib::Error>;
-
+ fn data(
+ &self,
+ data: &glib::Bytes,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<glib::Bytes, glib::Error>;
+
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_data_verify")]
- fn data_verify(&self, data: &glib::Bytes, signatures: &glib::Variant) -> Result<Option<glib::GString>, glib::Error>;
-
+ fn data_verify(
+ &self,
+ data: &glib::Bytes,
+ signatures: &glib::Variant,
+ ) -> Result<Option<glib::GString>, glib::Error>;
+
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_get_name")]
#[doc(alias = "get_name")]
fn name(&self) -> Option<glib::GString>;
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_load_pk")]
fn load_pk(&self, options: &glib::Variant) -> Result<(), glib::Error>;
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_metadata_format")]
fn metadata_format(&self) -> Option<glib::GString>;
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_metadata_key")]
fn metadata_key(&self) -> Option<glib::GString>;
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_set_pk")]
fn set_pk(&self, public_key: &glib::Variant) -> Result<(), glib::Error>;
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_set_sk")]
fn set_sk(&self, secret_key: &glib::Variant) -> Result<(), glib::Error>;
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_summary")]
- fn summary<P: IsA<gio::Cancellable>>(&self, repo: &Repo, keys: &glib::Variant, cancellable: Option<&P>) -> Result<(), glib::Error>;
+ fn summary(
+ &self,
+ repo: &Repo,
+ keys: &glib::Variant,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error>;
}
impl<O: IsA<Sign>> SignExt for O {
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
fn add_pk(&self, public_key: &glib::Variant) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sign_add_pk(self.as_ref().to_glib_none().0, public_key.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sign_add_pk(
+ self.as_ref().to_glib_none().0,
+ public_key.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))
+ }
}
}
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
fn clear_keys(&self) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sign_clear_keys(self.as_ref().to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sign_clear_keys(self.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))
+ }
}
}
- fn commit<P: IsA<gio::Cancellable>>(&self, repo: &Repo, commit_checksum: &str, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
+ fn commit(
+ &self,
+ repo: &Repo,
+ commit_checksum: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sign_commit(self.as_ref().to_glib_none().0, repo.to_glib_none().0, commit_checksum.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)) }
+ let is_ok = ffi::ostree_sign_commit(
+ self.as_ref().to_glib_none().0,
+ repo.to_glib_none().0,
+ commit_checksum.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))
+ }
}
}
- fn commit_verify<P: IsA<gio::Cancellable>>(&self, repo: &Repo, commit_checksum: &str, cancellable: Option<&P>) -> Result<Option<glib::GString>, glib::Error> {
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
+ fn commit_verify(
+ &self,
+ repo: &Repo,
+ commit_checksum: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<Option<glib::GString>, glib::Error> {
unsafe {
let mut out_success_message = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sign_commit_verify(self.as_ref().to_glib_none().0, repo.to_glib_none().0, commit_checksum.to_glib_none().0, &mut out_success_message, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_success_message)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sign_commit_verify(
+ self.as_ref().to_glib_none().0,
+ repo.to_glib_none().0,
+ commit_checksum.to_glib_none().0,
+ &mut out_success_message,
+ 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(from_glib_full(out_success_message))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
- fn data<P: IsA<gio::Cancellable>>(&self, data: &glib::Bytes, cancellable: Option<&P>) -> Result<glib::Bytes, glib::Error> {
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
+ fn data(
+ &self,
+ data: &glib::Bytes,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<glib::Bytes, glib::Error> {
unsafe {
let mut signature = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sign_data(self.as_ref().to_glib_none().0, data.to_glib_none().0, &mut signature, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(signature)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sign_data(
+ self.as_ref().to_glib_none().0,
+ data.to_glib_none().0,
+ &mut signature,
+ 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(from_glib_full(signature))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
- fn data_verify(&self, data: &glib::Bytes, signatures: &glib::Variant) -> Result<Option<glib::GString>, glib::Error> {
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
+ fn data_verify(
+ &self,
+ data: &glib::Bytes,
+ signatures: &glib::Variant,
+ ) -> Result<Option<glib::GString>, glib::Error> {
unsafe {
let mut out_success_message = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sign_data_verify(self.as_ref().to_glib_none().0, data.to_glib_none().0, signatures.to_glib_none().0, &mut out_success_message, &mut error);
- if error.is_null() { Ok(from_glib_full(out_success_message)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sign_data_verify(
+ self.as_ref().to_glib_none().0,
+ data.to_glib_none().0,
+ signatures.to_glib_none().0,
+ &mut out_success_message,
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib_full(out_success_message))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
fn name(&self) -> Option<glib::GString> {
- unsafe {
- from_glib_none(ffi::ostree_sign_get_name(self.as_ref().to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_sign_get_name(self.as_ref().to_glib_none().0)) }
}
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
fn load_pk(&self, options: &glib::Variant) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sign_load_pk(self.as_ref().to_glib_none().0, options.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sign_load_pk(
+ self.as_ref().to_glib_none().0,
+ options.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))
+ }
}
}
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
fn metadata_format(&self) -> Option<glib::GString> {
unsafe {
- from_glib_none(ffi::ostree_sign_metadata_format(self.as_ref().to_glib_none().0))
+ from_glib_none(ffi::ostree_sign_metadata_format(
+ self.as_ref().to_glib_none().0,
+ ))
}
}
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
fn metadata_key(&self) -> Option<glib::GString> {
unsafe {
- from_glib_none(ffi::ostree_sign_metadata_key(self.as_ref().to_glib_none().0))
+ from_glib_none(ffi::ostree_sign_metadata_key(
+ self.as_ref().to_glib_none().0,
+ ))
}
}
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
fn set_pk(&self, public_key: &glib::Variant) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sign_set_pk(self.as_ref().to_glib_none().0, public_key.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sign_set_pk(
+ self.as_ref().to_glib_none().0,
+ public_key.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))
+ }
}
}
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
fn set_sk(&self, secret_key: &glib::Variant) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sign_set_sk(self.as_ref().to_glib_none().0, secret_key.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sign_set_sk(
+ self.as_ref().to_glib_none().0,
+ secret_key.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))
+ }
}
}
- fn summary<P: IsA<gio::Cancellable>>(&self, repo: &Repo, keys: &glib::Variant, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ #[cfg(any(feature = "v2020_2", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
+ fn summary(
+ &self,
+ repo: &Repo,
+ keys: &glib::Variant,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sign_summary(self.as_ref().to_glib_none().0, repo.to_glib_none().0, keys.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)) }
+ let is_ok = ffi::ostree_sign_summary(
+ self.as_ref().to_glib_none().0,
+ repo.to_glib_none().0,
+ keys.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))
+ }
}
}
}
diff --git a/rust-bindings/src/auto/sysroot.rs b/rust-bindings/src/auto/sysroot.rs
index ecec2328..134bf7ed 100644
--- a/rust-bindings/src/auto/sysroot.rs
+++ b/rust-bindings/src/auto/sysroot.rs
@@ -47,114 +47,262 @@ glib::wrapper! {
impl Sysroot {
#[doc(alias = "ostree_sysroot_new")]
- pub fn new<P: IsA<gio::File>>(path: Option<&P>) -> Sysroot {
+ pub fn new(path: Option<&impl IsA<gio::File>>) -> Sysroot {
unsafe {
- from_glib_full(ffi::ostree_sysroot_new(path.map(|p| p.as_ref()).to_glib_none().0))
+ from_glib_full(ffi::ostree_sysroot_new(
+ path.map(|p| p.as_ref()).to_glib_none().0,
+ ))
}
}
#[doc(alias = "ostree_sysroot_new_default")]
pub fn new_default() -> Sysroot {
- unsafe {
- from_glib_full(ffi::ostree_sysroot_new_default())
- }
+ unsafe { from_glib_full(ffi::ostree_sysroot_new_default()) }
}
#[doc(alias = "ostree_sysroot_cleanup")]
- pub fn cleanup<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn cleanup(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_cleanup(self.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)) }
+ let is_ok = ffi::ostree_sysroot_cleanup(
+ self.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))
+ }
}
}
//#[cfg(any(feature = "v2018_6", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
//#[doc(alias = "ostree_sysroot_cleanup_prune_repo")]
- //pub fn cleanup_prune_repo<P: IsA<gio::Cancellable>>(&self, options: /*Ignored*/&mut RepoPruneOptions, cancellable: Option<&P>) -> Result<(i32, i32, u64), glib::Error> {
+ //pub fn cleanup_prune_repo(&self, options: /*Ignored*/&mut RepoPruneOptions, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(i32, i32, u64), glib::Error> {
// unsafe { TODO: call ffi:ostree_sysroot_cleanup_prune_repo() }
//}
#[cfg(any(feature = "v2018_5", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_5")))]
#[doc(alias = "ostree_sysroot_deploy_tree")]
- pub fn deploy_tree<P: IsA<gio::Cancellable>>(&self, osname: Option<&str>, revision: &str, origin: Option<&glib::KeyFile>, provided_merge_deployment: Option<&Deployment>, override_kernel_argv: &[&str], cancellable: Option<&P>) -> Result<Deployment, glib::Error> {
+ pub fn deploy_tree(
+ &self,
+ osname: Option<&str>,
+ revision: &str,
+ origin: Option<&glib::KeyFile>,
+ provided_merge_deployment: Option<&Deployment>,
+ override_kernel_argv: &[&str],
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<Deployment, glib::Error> {
unsafe {
let mut out_new_deployment = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_deploy_tree(self.to_glib_none().0, osname.to_glib_none().0, revision.to_glib_none().0, origin.to_glib_none().0, provided_merge_deployment.to_glib_none().0, override_kernel_argv.to_glib_none().0, &mut out_new_deployment, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_new_deployment)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sysroot_deploy_tree(
+ self.to_glib_none().0,
+ osname.to_glib_none().0,
+ revision.to_glib_none().0,
+ origin.to_glib_none().0,
+ provided_merge_deployment.to_glib_none().0,
+ override_kernel_argv.to_glib_none().0,
+ &mut out_new_deployment,
+ 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(from_glib_full(out_new_deployment))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2020_7", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))]
#[doc(alias = "ostree_sysroot_deploy_tree_with_options")]
- pub fn deploy_tree_with_options<P: IsA<gio::Cancellable>>(&self, osname: Option<&str>, revision: &str, origin: Option<&glib::KeyFile>, provided_merge_deployment: Option<&Deployment>, opts: Option<&SysrootDeployTreeOpts>, cancellable: Option<&P>) -> Result<Deployment, glib::Error> {
+ pub fn deploy_tree_with_options(
+ &self,
+ osname: Option<&str>,
+ revision: &str,
+ origin: Option<&glib::KeyFile>,
+ provided_merge_deployment: Option<&Deployment>,
+ opts: Option<&SysrootDeployTreeOpts>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<Deployment, glib::Error> {
unsafe {
let mut out_new_deployment = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_deploy_tree_with_options(self.to_glib_none().0, osname.to_glib_none().0, revision.to_glib_none().0, origin.to_glib_none().0, provided_merge_deployment.to_glib_none().0, mut_override(opts.to_glib_none().0), &mut out_new_deployment, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_new_deployment)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sysroot_deploy_tree_with_options(
+ self.to_glib_none().0,
+ osname.to_glib_none().0,
+ revision.to_glib_none().0,
+ origin.to_glib_none().0,
+ provided_merge_deployment.to_glib_none().0,
+ mut_override(opts.to_glib_none().0),
+ &mut out_new_deployment,
+ 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(from_glib_full(out_new_deployment))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_sysroot_deployment_set_kargs")]
- pub fn deployment_set_kargs<P: IsA<gio::Cancellable>>(&self, deployment: &Deployment, new_kargs: &[&str], cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn deployment_set_kargs(
+ &self,
+ deployment: &Deployment,
+ new_kargs: &[&str],
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_deployment_set_kargs(self.to_glib_none().0, deployment.to_glib_none().0, new_kargs.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)) }
+ let is_ok = ffi::ostree_sysroot_deployment_set_kargs(
+ self.to_glib_none().0,
+ deployment.to_glib_none().0,
+ new_kargs.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_sysroot_deployment_set_kargs_in_place")]
- pub fn deployment_set_kargs_in_place<P: IsA<gio::Cancellable>>(&self, deployment: &Deployment, kargs_str: Option<&str>, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn deployment_set_kargs_in_place(
+ &self,
+ deployment: &Deployment,
+ kargs_str: Option<&str>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_deployment_set_kargs_in_place(self.to_glib_none().0, deployment.to_glib_none().0, kargs_str.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)) }
+ let is_ok = ffi::ostree_sysroot_deployment_set_kargs_in_place(
+ self.to_glib_none().0,
+ deployment.to_glib_none().0,
+ kargs_str.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_sysroot_deployment_set_mutable")]
- pub fn deployment_set_mutable<P: IsA<gio::Cancellable>>(&self, deployment: &Deployment, is_mutable: bool, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn deployment_set_mutable(
+ &self,
+ deployment: &Deployment,
+ is_mutable: bool,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_deployment_set_mutable(self.to_glib_none().0, deployment.to_glib_none().0, is_mutable.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sysroot_deployment_set_mutable(
+ self.to_glib_none().0,
+ deployment.to_glib_none().0,
+ is_mutable.into_glib(),
+ 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))
+ }
}
}
#[cfg(any(feature = "v2018_3", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_3")))]
#[doc(alias = "ostree_sysroot_deployment_set_pinned")]
- pub fn deployment_set_pinned(&self, deployment: &Deployment, is_pinned: bool) -> Result<(), glib::Error> {
+ pub fn deployment_set_pinned(
+ &self,
+ deployment: &Deployment,
+ is_pinned: bool,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_deployment_set_pinned(self.to_glib_none().0, deployment.to_glib_none().0, is_pinned.into_glib(), &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sysroot_deployment_set_pinned(
+ self.to_glib_none().0,
+ deployment.to_glib_none().0,
+ is_pinned.into_glib(),
+ &mut error,
+ );
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(())
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2016_4", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_4")))]
#[doc(alias = "ostree_sysroot_deployment_unlock")]
- pub fn deployment_unlock<P: IsA<gio::Cancellable>>(&self, deployment: &Deployment, unlocked_state: DeploymentUnlockedState, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn deployment_unlock(
+ &self,
+ deployment: &Deployment,
+ unlocked_state: DeploymentUnlockedState,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_deployment_unlock(self.to_glib_none().0, deployment.to_glib_none().0, unlocked_state.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sysroot_deployment_unlock(
+ self.to_glib_none().0,
+ deployment.to_glib_none().0,
+ unlocked_state.into_glib(),
+ 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_sysroot_ensure_initialized")]
- pub fn ensure_initialized<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn ensure_initialized(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_ensure_initialized(self.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)) }
+ let is_ok = ffi::ostree_sysroot_ensure_initialized(
+ self.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))
+ }
}
}
@@ -162,23 +310,26 @@ impl Sysroot {
#[doc(alias = "get_booted_deployment")]
pub fn booted_deployment(&self) -> Option<Deployment> {
unsafe {
- from_glib_none(ffi::ostree_sysroot_get_booted_deployment(self.to_glib_none().0))
+ from_glib_none(ffi::ostree_sysroot_get_booted_deployment(
+ self.to_glib_none().0,
+ ))
}
}
#[doc(alias = "ostree_sysroot_get_bootversion")]
#[doc(alias = "get_bootversion")]
pub fn bootversion(&self) -> i32 {
- unsafe {
- ffi::ostree_sysroot_get_bootversion(self.to_glib_none().0)
- }
+ unsafe { ffi::ostree_sysroot_get_bootversion(self.to_glib_none().0) }
}
#[doc(alias = "ostree_sysroot_get_deployment_directory")]
#[doc(alias = "get_deployment_directory")]
pub fn deployment_directory(&self, deployment: &Deployment) -> Option<gio::File> {
unsafe {
- from_glib_full(ffi::ostree_sysroot_get_deployment_directory(self.to_glib_none().0, deployment.to_glib_none().0))
+ from_glib_full(ffi::ostree_sysroot_get_deployment_directory(
+ self.to_glib_none().0,
+ deployment.to_glib_none().0,
+ ))
}
}
@@ -186,7 +337,10 @@ impl Sysroot {
#[doc(alias = "get_deployment_dirpath")]
pub fn deployment_dirpath(&self, deployment: &Deployment) -> Option<glib::GString> {
unsafe {
- from_glib_full(ffi::ostree_sysroot_get_deployment_dirpath(self.to_glib_none().0, deployment.to_glib_none().0))
+ from_glib_full(ffi::ostree_sysroot_get_deployment_dirpath(
+ self.to_glib_none().0,
+ deployment.to_glib_none().0,
+ ))
}
}
@@ -194,32 +348,33 @@ impl Sysroot {
#[doc(alias = "get_deployments")]
pub fn deployments(&self) -> Vec<Deployment> {
unsafe {
- FromGlibPtrContainer::from_glib_container(ffi::ostree_sysroot_get_deployments(self.to_glib_none().0))
+ FromGlibPtrContainer::from_glib_container(ffi::ostree_sysroot_get_deployments(
+ self.to_glib_none().0,
+ ))
}
}
#[doc(alias = "ostree_sysroot_get_fd")]
#[doc(alias = "get_fd")]
pub fn fd(&self) -> i32 {
- unsafe {
- ffi::ostree_sysroot_get_fd(self.to_glib_none().0)
- }
+ unsafe { ffi::ostree_sysroot_get_fd(self.to_glib_none().0) }
}
#[doc(alias = "ostree_sysroot_get_merge_deployment")]
#[doc(alias = "get_merge_deployment")]
pub fn merge_deployment(&self, osname: Option<&str>) -> Option<Deployment> {
unsafe {
- from_glib_full(ffi::ostree_sysroot_get_merge_deployment(self.to_glib_none().0, osname.to_glib_none().0))
+ from_glib_full(ffi::ostree_sysroot_get_merge_deployment(
+ self.to_glib_none().0,
+ osname.to_glib_none().0,
+ ))
}
}
#[doc(alias = "ostree_sysroot_get_path")]
#[doc(alias = "get_path")]
pub fn path(&self) -> Option<gio::File> {
- unsafe {
- from_glib_none(ffi::ostree_sysroot_get_path(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_sysroot_get_path(self.to_glib_none().0)) }
}
#[cfg(any(feature = "v2018_5", feature = "dox"))]
@@ -228,26 +383,40 @@ impl Sysroot {
#[doc(alias = "get_staged_deployment")]
pub fn staged_deployment(&self) -> Option<Deployment> {
unsafe {
- from_glib_none(ffi::ostree_sysroot_get_staged_deployment(self.to_glib_none().0))
+ from_glib_none(ffi::ostree_sysroot_get_staged_deployment(
+ self.to_glib_none().0,
+ ))
}
}
#[doc(alias = "ostree_sysroot_get_subbootversion")]
#[doc(alias = "get_subbootversion")]
pub fn subbootversion(&self) -> i32 {
- unsafe {
- ffi::ostree_sysroot_get_subbootversion(self.to_glib_none().0)
- }
+ unsafe { ffi::ostree_sysroot_get_subbootversion(self.to_glib_none().0) }
}
#[cfg(any(feature = "v2016_4", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_4")))]
#[doc(alias = "ostree_sysroot_init_osname")]
- pub fn init_osname<P: IsA<gio::Cancellable>>(&self, osname: &str, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn init_osname(
+ &self,
+ osname: &str,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_init_osname(self.to_glib_none().0, osname.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)) }
+ let is_ok = ffi::ostree_sysroot_init_osname(
+ self.to_glib_none().0,
+ osname.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))
+ }
}
}
@@ -257,8 +426,13 @@ impl Sysroot {
pub fn initialize(&self) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_initialize(self.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sysroot_initialize(self.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))
+ }
}
}
@@ -266,30 +440,53 @@ impl Sysroot {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_1")))]
#[doc(alias = "ostree_sysroot_is_booted")]
pub fn is_booted(&self) -> bool {
- unsafe {
- from_glib(ffi::ostree_sysroot_is_booted(self.to_glib_none().0))
- }
+ unsafe { from_glib(ffi::ostree_sysroot_is_booted(self.to_glib_none().0)) }
}
#[doc(alias = "ostree_sysroot_load")]
- pub fn load<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn load(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_load(self.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)) }
+ let is_ok = ffi::ostree_sysroot_load(
+ self.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))
+ }
}
}
#[cfg(any(feature = "v2016_4", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_4")))]
#[doc(alias = "ostree_sysroot_load_if_changed")]
- pub fn load_if_changed<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<bool, glib::Error> {
+ pub fn load_if_changed(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<bool, glib::Error> {
unsafe {
let mut out_changed = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_load_if_changed(self.to_glib_none().0, out_changed.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
+ let is_ok = ffi::ostree_sysroot_load_if_changed(
+ self.to_glib_none().0,
+ out_changed.as_mut_ptr(),
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
let out_changed = out_changed.assume_init();
- if error.is_null() { Ok(from_glib(out_changed)) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib(out_changed))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -297,64 +494,119 @@ impl Sysroot {
pub fn lock(&self) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_lock(self.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sysroot_lock(self.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_sysroot_lock_async")]
- pub fn lock_async<P: IsA<gio::Cancellable>, Q: FnOnce(Result<(), glib::Error>) + Send + 'static>(&self, cancellable: Option<&P>, callback: Q) {
- let user_data: Box_<Q> = Box_::new(callback);
- unsafe extern "C" fn lock_async_trampoline<Q: FnOnce(Result<(), glib::Error>) + Send + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) {
+ pub fn lock_async<P: FnOnce(Result<(), glib::Error>) + 'static>(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ callback: P,
+ ) {
+ let main_context = glib::MainContext::ref_thread_default();
+ let is_main_context_owner = main_context.is_owner();
+ let has_acquired_main_context = (!is_main_context_owner)
+ .then(|| main_context.acquire().ok())
+ .flatten();
+ assert!(
+ is_main_context_owner || has_acquired_main_context.is_some(),
+ "Async operations only allowed if the thread is owning the MainContext"
+ );
+
+ let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
+ Box_::new(glib::thread_guard::ThreadGuard::new(callback));
+ unsafe extern "C" fn lock_async_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(
+ _source_object: *mut glib::gobject_ffi::GObject,
+ res: *mut gio::ffi::GAsyncResult,
+ user_data: glib::ffi::gpointer,
+ ) {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_lock_finish(_source_object as *mut _, res, &mut error);
- let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) };
- let callback: Box_<Q> = Box_::from_raw(user_data as *mut _);
+ let result = if error.is_null() {
+ Ok(())
+ } else {
+ Err(from_glib_full(error))
+ };
+ let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
+ Box_::from_raw(user_data as *mut _);
+ let callback: P = callback.into_inner();
callback(result);
}
- let callback = lock_async_trampoline::<Q>;
+ let callback = lock_async_trampoline::<P>;
unsafe {
- ffi::ostree_sysroot_lock_async(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _);
+ ffi::ostree_sysroot_lock_async(
+ self.to_glib_none().0,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ Some(callback),
+ Box_::into_raw(user_data) as *mut _,
+ );
}
}
-
- pub fn lock_async_future(&self) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
-
+ pub fn lock_future(
+ &self,
+ ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
- obj.lock_async(
- Some(cancellable),
- move |res| {
- send.resolve(res);
- },
- );
+ obj.lock_async(Some(cancellable), move |res| {
+ send.resolve(res);
+ });
}))
}
#[doc(alias = "ostree_sysroot_origin_new_from_refspec")]
pub fn origin_new_from_refspec(&self, refspec: &str) -> Option<glib::KeyFile> {
unsafe {
- from_glib_full(ffi::ostree_sysroot_origin_new_from_refspec(self.to_glib_none().0, refspec.to_glib_none().0))
+ from_glib_full(ffi::ostree_sysroot_origin_new_from_refspec(
+ self.to_glib_none().0,
+ refspec.to_glib_none().0,
+ ))
}
}
#[doc(alias = "ostree_sysroot_prepare_cleanup")]
- pub fn prepare_cleanup<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn prepare_cleanup(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_prepare_cleanup(self.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)) }
+ let is_ok = ffi::ostree_sysroot_prepare_cleanup(
+ self.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))
+ }
}
}
#[cfg(any(feature = "v2017_7", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_7")))]
#[doc(alias = "ostree_sysroot_query_deployments_for")]
- pub fn query_deployments_for(&self, osname: Option<&str>) -> (Option<Deployment>, Option<Deployment>) {
+ pub fn query_deployments_for(
+ &self,
+ osname: Option<&str>,
+ ) -> (Option<Deployment>, Option<Deployment>) {
unsafe {
let mut out_pending = ptr::null_mut();
let mut out_rollback = ptr::null_mut();
- ffi::ostree_sysroot_query_deployments_for(self.to_glib_none().0, osname.to_glib_none().0, &mut out_pending, &mut out_rollback);
+ ffi::ostree_sysroot_query_deployments_for(
+ self.to_glib_none().0,
+ osname.to_glib_none().0,
+ &mut out_pending,
+ &mut out_rollback,
+ );
(from_glib_full(out_pending), from_glib_full(out_rollback))
}
}
@@ -363,9 +615,7 @@ impl Sysroot {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_7")))]
#[doc(alias = "ostree_sysroot_repo")]
pub fn repo(&self) -> Option<Repo> {
- unsafe {
- from_glib_none(ffi::ostree_sysroot_repo(self.to_glib_none().0))
- }
+ unsafe { from_glib_none(ffi::ostree_sysroot_repo(self.to_glib_none().0)) }
}
#[cfg(any(feature = "v2021_1", feature = "dox"))]
@@ -374,8 +624,13 @@ impl Sysroot {
pub fn require_booted_deployment(&self) -> Result<Deployment, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let ret = ffi::ostree_sysroot_require_booted_deployment(self.to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) }
+ let ret =
+ ffi::ostree_sysroot_require_booted_deployment(self.to_glib_none().0, &mut error);
+ if error.is_null() {
+ Ok(from_glib_none(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -389,47 +644,128 @@ impl Sysroot {
}
#[doc(alias = "ostree_sysroot_simple_write_deployment")]
- pub fn simple_write_deployment<P: IsA<gio::Cancellable>>(&self, osname: Option<&str>, new_deployment: &Deployment, merge_deployment: Option<&Deployment>, flags: SysrootSimpleWriteDeploymentFlags, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn simple_write_deployment(
+ &self,
+ osname: Option<&str>,
+ new_deployment: &Deployment,
+ merge_deployment: Option<&Deployment>,
+ flags: SysrootSimpleWriteDeploymentFlags,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_simple_write_deployment(self.to_glib_none().0, osname.to_glib_none().0, new_deployment.to_glib_none().0, merge_deployment.to_glib_none().0, flags.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sysroot_simple_write_deployment(
+ self.to_glib_none().0,
+ osname.to_glib_none().0,
+ new_deployment.to_glib_none().0,
+ merge_deployment.to_glib_none().0,
+ flags.into_glib(),
+ 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))
+ }
}
}
#[cfg(any(feature = "v2020_7", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))]
#[doc(alias = "ostree_sysroot_stage_overlay_initrd")]
- pub fn stage_overlay_initrd<P: IsA<gio::Cancellable>>(&self, fd: i32, cancellable: Option<&P>) -> Result<glib::GString, glib::Error> {
+ pub fn stage_overlay_initrd(
+ &self,
+ fd: i32,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<glib::GString, glib::Error> {
unsafe {
let mut out_checksum = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_stage_overlay_initrd(self.to_glib_none().0, fd, &mut out_checksum, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_checksum)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sysroot_stage_overlay_initrd(
+ self.to_glib_none().0,
+ fd,
+ &mut out_checksum,
+ 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(from_glib_full(out_checksum))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2018_5", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_5")))]
#[doc(alias = "ostree_sysroot_stage_tree")]
- pub fn stage_tree<P: IsA<gio::Cancellable>>(&self, osname: Option<&str>, revision: &str, origin: Option<&glib::KeyFile>, merge_deployment: Option<&Deployment>, override_kernel_argv: &[&str], cancellable: Option<&P>) -> Result<Deployment, glib::Error> {
+ pub fn stage_tree(
+ &self,
+ osname: Option<&str>,
+ revision: &str,
+ origin: Option<&glib::KeyFile>,
+ merge_deployment: Option<&Deployment>,
+ override_kernel_argv: &[&str],
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<Deployment, glib::Error> {
unsafe {
let mut out_new_deployment = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_stage_tree(self.to_glib_none().0, osname.to_glib_none().0, revision.to_glib_none().0, origin.to_glib_none().0, merge_deployment.to_glib_none().0, override_kernel_argv.to_glib_none().0, &mut out_new_deployment, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_new_deployment)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sysroot_stage_tree(
+ self.to_glib_none().0,
+ osname.to_glib_none().0,
+ revision.to_glib_none().0,
+ origin.to_glib_none().0,
+ merge_deployment.to_glib_none().0,
+ override_kernel_argv.to_glib_none().0,
+ &mut out_new_deployment,
+ 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(from_glib_full(out_new_deployment))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[cfg(any(feature = "v2020_7", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))]
#[doc(alias = "ostree_sysroot_stage_tree_with_options")]
- pub fn stage_tree_with_options<P: IsA<gio::Cancellable>>(&self, osname: Option<&str>, revision: &str, origin: Option<&glib::KeyFile>, merge_deployment: Option<&Deployment>, opts: &SysrootDeployTreeOpts, cancellable: Option<&P>) -> Result<Deployment, glib::Error> {
+ pub fn stage_tree_with_options(
+ &self,
+ osname: Option<&str>,
+ revision: &str,
+ origin: Option<&glib::KeyFile>,
+ merge_deployment: Option<&Deployment>,
+ opts: &SysrootDeployTreeOpts,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<Deployment, glib::Error> {
unsafe {
let mut out_new_deployment = ptr::null_mut();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_stage_tree_with_options(self.to_glib_none().0, osname.to_glib_none().0, revision.to_glib_none().0, origin.to_glib_none().0, merge_deployment.to_glib_none().0, mut_override(opts.to_glib_none().0), &mut out_new_deployment, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(out_new_deployment)) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sysroot_stage_tree_with_options(
+ self.to_glib_none().0,
+ osname.to_glib_none().0,
+ revision.to_glib_none().0,
+ origin.to_glib_none().0,
+ merge_deployment.to_glib_none().0,
+ mut_override(opts.to_glib_none().0),
+ &mut out_new_deployment,
+ 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(from_glib_full(out_new_deployment))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -438,9 +774,18 @@ impl Sysroot {
unsafe {
let mut out_acquired = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_try_lock(self.to_glib_none().0, out_acquired.as_mut_ptr(), &mut error);
+ let is_ok = ffi::ostree_sysroot_try_lock(
+ self.to_glib_none().0,
+ out_acquired.as_mut_ptr(),
+ &mut error,
+ );
let out_acquired = out_acquired.assume_init();
- if error.is_null() { Ok(from_glib(out_acquired)) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib(out_acquired))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
@@ -459,39 +804,87 @@ impl Sysroot {
}
#[doc(alias = "ostree_sysroot_write_deployments")]
- pub fn write_deployments<P: IsA<gio::Cancellable>>(&self, new_deployments: &[Deployment], cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn write_deployments(
+ &self,
+ new_deployments: &[Deployment],
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_write_deployments(self.to_glib_none().0, new_deployments.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)) }
+ let is_ok = ffi::ostree_sysroot_write_deployments(
+ self.to_glib_none().0,
+ new_deployments.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))
+ }
}
}
#[cfg(any(feature = "v2017_4", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_4")))]
#[doc(alias = "ostree_sysroot_write_deployments_with_options")]
- pub fn write_deployments_with_options<P: IsA<gio::Cancellable>>(&self, new_deployments: &[Deployment], opts: &SysrootWriteDeploymentsOpts, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn write_deployments_with_options(
+ &self,
+ new_deployments: &[Deployment],
+ opts: &SysrootWriteDeploymentsOpts,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_write_deployments_with_options(self.to_glib_none().0, new_deployments.to_glib_none().0, mut_override(opts.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)) }
+ let is_ok = ffi::ostree_sysroot_write_deployments_with_options(
+ self.to_glib_none().0,
+ new_deployments.to_glib_none().0,
+ mut_override(opts.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_sysroot_write_origin_file")]
- pub fn write_origin_file<P: IsA<gio::Cancellable>>(&self, deployment: &Deployment, new_origin: Option<&glib::KeyFile>, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn write_origin_file(
+ &self,
+ deployment: &Deployment,
+ new_origin: Option<&glib::KeyFile>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_write_origin_file(self.to_glib_none().0, deployment.to_glib_none().0, new_origin.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)) }
+ let is_ok = ffi::ostree_sysroot_write_origin_file(
+ self.to_glib_none().0,
+ deployment.to_glib_none().0,
+ new_origin.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_sysroot_get_deployment_origin_path")]
#[doc(alias = "get_deployment_origin_path")]
- pub fn deployment_origin_path<P: IsA<gio::File>>(deployment_path: &P) -> Option<gio::File> {
+ pub fn deployment_origin_path(deployment_path: &impl IsA<gio::File>) -> Option<gio::File> {
unsafe {
- from_glib_full(ffi::ostree_sysroot_get_deployment_origin_path(deployment_path.as_ref().to_glib_none().0))
+ from_glib_full(ffi::ostree_sysroot_get_deployment_origin_path(
+ deployment_path.as_ref().to_glib_none().0,
+ ))
}
}
@@ -499,14 +892,27 @@ impl Sysroot {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))]
#[doc(alias = "journal-msg")]
pub fn connect_journal_msg<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
- unsafe extern "C" fn journal_msg_trampoline<F: Fn(&Sysroot, &str) + 'static>(this: *mut ffi::OstreeSysroot, msg: *mut libc::c_char, f: glib::ffi::gpointer) {
+ unsafe extern "C" fn journal_msg_trampoline<F: Fn(&Sysroot, &str) + 'static>(
+ this: *mut ffi::OstreeSysroot,
+ msg: *mut libc::c_char,
+ f: glib::ffi::gpointer,
+ ) {
let f: &F = &*(f as *const F);
- f(&from_glib_borrow(this), &glib::GString::from_glib_borrow(msg))
+ f(
+ &from_glib_borrow(this),
+ &glib::GString::from_glib_borrow(msg),
+ )
}
unsafe {
let f: Box_<F> = Box_::new(f);
- connect_raw(self.as_ptr() as *mut _, b"journal-msg\0".as_ptr() as *const _,
- Some(transmute::<_, unsafe extern "C" fn()>(journal_msg_trampoline::<F> as *const ())), Box_::into_raw(f))
+ connect_raw(
+ self.as_ptr() as *mut _,
+ b"journal-msg\0".as_ptr() as *const _,
+ Some(transmute::<_, unsafe extern "C" fn()>(
+ journal_msg_trampoline::<F> as *const (),
+ )),
+ Box_::into_raw(f),
+ )
}
}
}
diff --git a/rust-bindings/src/auto/sysroot_upgrader.rs b/rust-bindings/src/auto/sysroot_upgrader.rs
index 0e932534..f16e3900 100644
--- a/rust-bindings/src/auto/sysroot_upgrader.rs
+++ b/rust-bindings/src/auto/sysroot_upgrader.rs
@@ -27,47 +27,100 @@ glib::wrapper! {
impl SysrootUpgrader {
#[doc(alias = "ostree_sysroot_upgrader_new")]
- pub fn new<P: IsA<gio::Cancellable>>(sysroot: &Sysroot, cancellable: Option<&P>) -> Result<SysrootUpgrader, glib::Error> {
+ pub fn new(
+ sysroot: &Sysroot,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<SysrootUpgrader, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let ret = ffi::ostree_sysroot_upgrader_new(sysroot.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ let ret = ffi::ostree_sysroot_upgrader_new(
+ sysroot.to_glib_none().0,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_sysroot_upgrader_new_for_os")]
#[doc(alias = "new_for_os")]
- pub fn for_os<P: IsA<gio::Cancellable>>(sysroot: &Sysroot, osname: Option<&str>, cancellable: Option<&P>) -> Result<SysrootUpgrader, glib::Error> {
+ pub fn for_os(
+ sysroot: &Sysroot,
+ osname: Option<&str>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<SysrootUpgrader, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let ret = ffi::ostree_sysroot_upgrader_new_for_os(sysroot.to_glib_none().0, osname.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ let ret = ffi::ostree_sysroot_upgrader_new_for_os(
+ sysroot.to_glib_none().0,
+ osname.to_glib_none().0,
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_sysroot_upgrader_new_for_os_with_flags")]
#[doc(alias = "new_for_os_with_flags")]
- pub fn for_os_with_flags<P: IsA<gio::Cancellable>>(sysroot: &Sysroot, osname: Option<&str>, flags: SysrootUpgraderFlags, cancellable: Option<&P>) -> Result<SysrootUpgrader, glib::Error> {
+ pub fn for_os_with_flags(
+ sysroot: &Sysroot,
+ osname: Option<&str>,
+ flags: SysrootUpgraderFlags,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<SysrootUpgrader, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let ret = ffi::ostree_sysroot_upgrader_new_for_os_with_flags(sysroot.to_glib_none().0, osname.to_glib_none().0, flags.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
- if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
+ let ret = ffi::ostree_sysroot_upgrader_new_for_os_with_flags(
+ sysroot.to_glib_none().0,
+ osname.to_glib_none().0,
+ flags.into_glib(),
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
+ if error.is_null() {
+ Ok(from_glib_full(ret))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_sysroot_upgrader_deploy")]
- pub fn deploy<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn deploy(
+ &self,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_upgrader_deploy(self.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)) }
+ let is_ok = ffi::ostree_sysroot_upgrader_deploy(
+ self.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_sysroot_upgrader_dup_origin")]
pub fn dup_origin(&self) -> Option<glib::KeyFile> {
unsafe {
- from_glib_full(ffi::ostree_sysroot_upgrader_dup_origin(self.to_glib_none().0))
+ from_glib_full(ffi::ostree_sysroot_upgrader_dup_origin(
+ self.to_glib_none().0,
+ ))
}
}
@@ -75,7 +128,9 @@ impl SysrootUpgrader {
#[doc(alias = "get_origin")]
pub fn origin(&self) -> Option<glib::KeyFile> {
unsafe {
- from_glib_none(ffi::ostree_sysroot_upgrader_get_origin(self.to_glib_none().0))
+ from_glib_none(ffi::ostree_sysroot_upgrader_get_origin(
+ self.to_glib_none().0,
+ ))
}
}
@@ -83,71 +138,125 @@ impl SysrootUpgrader {
#[doc(alias = "get_origin_description")]
pub fn origin_description(&self) -> Option<glib::GString> {
unsafe {
- from_glib_full(ffi::ostree_sysroot_upgrader_get_origin_description(self.to_glib_none().0))
+ from_glib_full(ffi::ostree_sysroot_upgrader_get_origin_description(
+ self.to_glib_none().0,
+ ))
}
}
#[doc(alias = "ostree_sysroot_upgrader_pull")]
- pub fn pull<P: IsA<gio::Cancellable>>(&self, flags: RepoPullFlags, upgrader_flags: SysrootUpgraderPullFlags, progress: Option<&AsyncProgress>, cancellable: Option<&P>) -> Result<bool, glib::Error> {
+ pub fn pull(
+ &self,
+ flags: RepoPullFlags,
+ upgrader_flags: SysrootUpgraderPullFlags,
+ progress: Option<&AsyncProgress>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<bool, glib::Error> {
unsafe {
let mut out_changed = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_upgrader_pull(self.to_glib_none().0, flags.into_glib(), upgrader_flags.into_glib(), progress.to_glib_none().0, out_changed.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
+ let is_ok = ffi::ostree_sysroot_upgrader_pull(
+ self.to_glib_none().0,
+ flags.into_glib(),
+ upgrader_flags.into_glib(),
+ progress.to_glib_none().0,
+ out_changed.as_mut_ptr(),
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
let out_changed = out_changed.assume_init();
- if error.is_null() { Ok(from_glib(out_changed)) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib(out_changed))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_sysroot_upgrader_pull_one_dir")]
- pub fn pull_one_dir<P: IsA<gio::Cancellable>>(&self, dir_to_pull: &str, flags: RepoPullFlags, upgrader_flags: SysrootUpgraderPullFlags, progress: Option<&AsyncProgress>, cancellable: Option<&P>) -> Result<bool, glib::Error> {
+ pub fn pull_one_dir(
+ &self,
+ dir_to_pull: &str,
+ flags: RepoPullFlags,
+ upgrader_flags: SysrootUpgraderPullFlags,
+ progress: Option<&AsyncProgress>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<bool, glib::Error> {
unsafe {
let mut out_changed = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_upgrader_pull_one_dir(self.to_glib_none().0, dir_to_pull.to_glib_none().0, flags.into_glib(), upgrader_flags.into_glib(), progress.to_glib_none().0, out_changed.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
+ let is_ok = ffi::ostree_sysroot_upgrader_pull_one_dir(
+ self.to_glib_none().0,
+ dir_to_pull.to_glib_none().0,
+ flags.into_glib(),
+ upgrader_flags.into_glib(),
+ progress.to_glib_none().0,
+ out_changed.as_mut_ptr(),
+ cancellable.map(|p| p.as_ref()).to_glib_none().0,
+ &mut error,
+ );
let out_changed = out_changed.assume_init();
- if error.is_null() { Ok(from_glib(out_changed)) } else { Err(from_glib_full(error)) }
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() {
+ Ok(from_glib(out_changed))
+ } else {
+ Err(from_glib_full(error))
+ }
}
}
#[doc(alias = "ostree_sysroot_upgrader_set_origin")]
- pub fn set_origin<P: IsA<gio::Cancellable>>(&self, origin: Option<&glib::KeyFile>, cancellable: Option<&P>) -> Result<(), glib::Error> {
+ pub fn set_origin(
+ &self,
+ origin: Option<&glib::KeyFile>,
+ cancellable: Option<&impl IsA<gio::Cancellable>>,
+ ) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_upgrader_set_origin(self.to_glib_none().0, origin.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)) }
+ let is_ok = ffi::ostree_sysroot_upgrader_set_origin(
+ self.to_glib_none().0,
+ origin.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))
+ }
}
}
pub fn flags(&self) -> SysrootUpgraderFlags {
- unsafe {
- let mut value = glib::Value::from_type(<SysrootUpgraderFlags as StaticType>::static_type());
- glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"flags\0".as_ptr() as *const _, value.to_glib_none_mut().0);
- value.get().expect("Return Value for property `flags` getter")
- }
+ glib::ObjectExt::property(self, "flags")
}
pub fn osname(&self) -> Option<glib::GString> {
- unsafe {
- let mut value = glib::Value::from_type(<glib::GString as StaticType>::static_type());
- glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"osname\0".as_ptr() as *const _, value.to_glib_none_mut().0);
- value.get().expect("Return Value for property `osname` getter")
- }
+ glib::ObjectExt::property(self, "osname")
}
pub fn sysroot(&self) -> Option<Sysroot> {
- unsafe {
- let mut value = glib::Value::from_type(<Sysroot as StaticType>::static_type());
- glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"sysroot\0".as_ptr() as *const _, value.to_glib_none_mut().0);
- value.get().expect("Return Value for property `sysroot` getter")
- }
+ glib::ObjectExt::property(self, "sysroot")
}
#[doc(alias = "ostree_sysroot_upgrader_check_timestamps")]
pub fn check_timestamps(repo: &Repo, from_rev: &str, to_rev: &str) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
- let _ = ffi::ostree_sysroot_upgrader_check_timestamps(repo.to_glib_none().0, from_rev.to_glib_none().0, to_rev.to_glib_none().0, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ let is_ok = ffi::ostree_sysroot_upgrader_check_timestamps(
+ repo.to_glib_none().0,
+ from_rev.to_glib_none().0,
+ to_rev.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))
+ }
}
}
}
diff --git a/rust-bindings/src/auto/versions.txt b/rust-bindings/src/auto/versions.txt
index 57f26297..15372ec6 100644
--- a/rust-bindings/src/auto/versions.txt
+++ b/rust-bindings/src/auto/versions.txt
@@ -1,2 +1,2 @@
-Generated by gir (https://github.com/gtk-rs/gir @ e8f82cf6)
-from gir-files (@ a19cc348)
+Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d)
+from gir-files (@ 94f67628d6ed)
diff --git a/rust-bindings/src/repo.rs b/rust-bindings/src/repo.rs
index 1e3e90bc..1333fd5f 100644
--- a/rust-bindings/src/repo.rs
+++ b/rust-bindings/src/repo.rs
@@ -94,7 +94,7 @@ impl<'a> Drop for TransactionGuard<'a> {
if let Some(repo) = self.repo {
// TODO: better logging in ostree?
// See also https://github.com/ostreedev/ostree/issues/2413
- let _ = repo.abort_transaction(gio::NONE_CANCELLABLE);
+ let _ = repo.abort_transaction(gio::Cancellable::NONE);
}
}
}
@@ -109,7 +109,7 @@ impl Repo {
/// A version of [`open_at`] which uses cap-std.
pub fn open_at_dir(dir: &cap_std::fs::Dir, path: &str) -> Result<Repo, glib::Error> {
use std::os::unix::io::AsRawFd;
- crate::Repo::open_at(dir.as_raw_fd(), path, gio::NONE_CANCELLABLE)
+ crate::Repo::open_at(dir.as_raw_fd(), path, gio::Cancellable::NONE)
}
#[cfg(feature = "cap-std-apis")]
@@ -121,7 +121,7 @@ impl Repo {
options: Option<&glib::Variant>,
) -> Result<Repo, glib::Error> {
use std::os::unix::io::AsRawFd;
- crate::Repo::create_at(dir.as_raw_fd(), path, mode, options, gio::NONE_CANCELLABLE)?;
+ crate::Repo::create_at(dir.as_raw_fd(), path, mode, options, gio::Cancellable::NONE)?;
Repo::open_at_dir(dir, path)
}
diff --git a/rust-bindings/src/repo_checkout_at_options/mod.rs b/rust-bindings/src/repo_checkout_at_options/mod.rs
index b0ded2c7..099bd229 100644
--- a/rust-bindings/src/repo_checkout_at_options/mod.rs
+++ b/rust-bindings/src/repo_checkout_at_options/mod.rs
@@ -243,7 +243,7 @@ mod tests {
}),
#[cfg(feature = "v2017_6")]
sepolicy: Some(
- SePolicy::new(&gio::File::for_path("a/b"), gio::NONE_CANCELLABLE).unwrap(),
+ SePolicy::new(&gio::File::for_path("a/b"), gio::Cancellable::NONE).unwrap(),
),
sepolicy_prefix: Some("prefix".into()),
};
diff --git a/rust-bindings/src/repo_transaction_stats.rs b/rust-bindings/src/repo_transaction_stats.rs
index 1d12531b..fef985c2 100644
--- a/rust-bindings/src/repo_transaction_stats.rs
+++ b/rust-bindings/src/repo_transaction_stats.rs
@@ -1,3 +1,5 @@
+use glib::translate::FromGlibPtrFull;
+
glib::wrapper! {
/// A list of statistics for each transaction that may be interesting for reporting purposes.
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
@@ -6,8 +8,6 @@ glib::wrapper! {
match fn {
copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::ostree_repo_transaction_stats_get_type(), ptr as *mut _) as *mut ffi::OstreeRepoTransactionStats,
free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::ostree_repo_transaction_stats_get_type(), ptr as *mut _),
- init => |_ptr| (),
- clear => |_ptr| (),
type_ => || ffi::ostree_repo_transaction_stats_get_type(),
}
}
@@ -15,31 +15,39 @@ glib::wrapper! {
impl RepoTransactionStats {
/// The total number of metadata objects in the repository after this transaction has completed.
pub fn get_metadata_objects_total(&self) -> usize {
- self.0.metadata_objects_total as usize
+ self.inner.metadata_objects_total as usize
}
/// The number of metadata objects that were written to the repository in this transaction.
pub fn get_metadata_objects_written(&self) -> usize {
- self.0.metadata_objects_written as usize
+ self.inner.metadata_objects_written as usize
}
/// The total number of content objects in the repository after this transaction has completed.
pub fn get_content_objects_total(&self) -> usize {
- self.0.content_objects_total as usize
+ self.inner.content_objects_total as usize
}
/// The number of content objects that were written to the repository in this transaction.
pub fn get_content_objects_written(&self) -> usize {
- self.0.content_objects_written as usize
+ self.inner.content_objects_written as usize
}
/// The amount of data added to the repository, in bytes, counting only content objects.
pub fn get_content_bytes_written(&self) -> u64 {
- self.0.content_bytes_written
+ self.inner.content_bytes_written
}
/// The amount of cache hits during this transaction.
pub fn get_devino_cache_hits(&self) -> usize {
- self.0.devino_cache_hits as usize
+ self.inner.devino_cache_hits as usize
+ }
+
+ /// Create new uninitialized stats.
+ pub(crate) fn uninitialized() -> Self {
+ unsafe {
+ let stats: ffi::OstreeRepoTransactionStats = std::mem::zeroed();
+ Self::from_glib_full(Box::into_raw(Box::new(stats)))
+ }
}
}
diff --git a/rust-bindings/src/sysroot.rs b/rust-bindings/src/sysroot.rs
index 5255c286..d7b2b767 100644
--- a/rust-bindings/src/sysroot.rs
+++ b/rust-bindings/src/sysroot.rs
@@ -76,14 +76,14 @@ mod tests {
let tmp_path = Some(tmpdir.path().to_path_buf());
let builder = SysrootBuilder::new().path(tmp_path);
- let sysroot = builder.create(gio::NONE_CANCELLABLE).unwrap();
+ let sysroot = builder.create(gio::Cancellable::NONE).unwrap();
assert!(sysroot.fd() >= 0);
assert_eq!(sysroot.deployments().len(), 0);
assert_eq!(sysroot.booted_deployment(), None);
assert_eq!(sysroot.bootversion(), 0);
assert_eq!(sysroot.subbootversion(), 0);
- sysroot.cleanup(gio::NONE_CANCELLABLE).unwrap();
+ sysroot.cleanup(gio::Cancellable::NONE).unwrap();
sysroot.path().unwrap()
};
@@ -91,14 +91,14 @@ mod tests {
let tmp_path = Some(tmpdir.path().to_path_buf());
let builder = SysrootBuilder::new().path(tmp_path);
- let sysroot = builder.create(gio::NONE_CANCELLABLE).unwrap();
+ let sysroot = builder.create(gio::Cancellable::NONE).unwrap();
assert!(sysroot.fd() >= 0);
assert_eq!(sysroot.deployments().len(), 0);
assert_eq!(sysroot.booted_deployment(), None);
assert_eq!(sysroot.bootversion(), 0);
assert_eq!(sysroot.subbootversion(), 0);
- sysroot.cleanup(gio::NONE_CANCELLABLE).unwrap();
+ sysroot.cleanup(gio::Cancellable::NONE).unwrap();
sysroot.path().unwrap()
};
diff --git a/rust-bindings/sys/src/auto/versions.txt b/rust-bindings/sys/src/auto/versions.txt
index 6a5d9bd6..15372ec6 100644
--- a/rust-bindings/sys/src/auto/versions.txt
+++ b/rust-bindings/sys/src/auto/versions.txt
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d)
-from gir-files (@ b19a13a583ef)
+from gir-files (@ 94f67628d6ed)
diff --git a/rust-bindings/tests/functions/mod.rs b/rust-bindings/tests/functions/mod.rs
index e041ddfb..610ff780 100644
--- a/rust-bindings/tests/functions/mod.rs
+++ b/rust-bindings/tests/functions/mod.rs
@@ -1,5 +1,4 @@
use crate::util::TestRepo;
-use gio::NONE_CANCELLABLE;
use ostree::{checksum_file_from_input, ObjectType};
#[test]
@@ -13,7 +12,7 @@ fn list_repo_objects() {
let objects = repo
.repo
- .list_objects(ffi::OSTREE_REPO_LIST_OBJECTS_ALL, NONE_CANCELLABLE)
+ .list_objects(ffi::OSTREE_REPO_LIST_OBJECTS_ALL, gio::Cancellable::NONE)
.expect("List Objects");
for (object, _items) in objects {
match object.object_type() {
@@ -48,7 +47,7 @@ fn should_checksum_file_from_input() {
let objects = repo
.repo
- .traverse_commit(&commit_checksum, -1, NONE_CANCELLABLE)
+ .traverse_commit(&commit_checksum, -1, gio::Cancellable::NONE)
.expect("traverse commit");
for obj in objects {
if obj.object_type() != ObjectType::File {
@@ -56,14 +55,14 @@ fn should_checksum_file_from_input() {
}
let (stream, file_info, xattrs) = repo
.repo
- .load_file(obj.checksum(), NONE_CANCELLABLE)
+ .load_file(obj.checksum(), gio::Cancellable::NONE)
.expect("load file");
let result = checksum_file_from_input(
&file_info,
Some(&xattrs),
stream.as_ref(),
ObjectType::File,
- NONE_CANCELLABLE,
+ gio::Cancellable::NONE,
)
.expect("checksum file from input");
assert_eq!(result.to_string(), obj.checksum());
diff --git a/rust-bindings/tests/repo/checkout_at.rs b/rust-bindings/tests/repo/checkout_at.rs
index 94028642..7cc6b114 100644
--- a/rust-bindings/tests/repo/checkout_at.rs
+++ b/rust-bindings/tests/repo/checkout_at.rs
@@ -1,5 +1,4 @@
use crate::util::*;
-use gio::NONE_CANCELLABLE;
use ostree::*;
use std::os::unix::io::AsRawFd;
@@ -17,7 +16,7 @@ fn should_checkout_at_with_none_options() {
dirfd.as_raw_fd(),
"test-checkout",
&checksum,
- NONE_CANCELLABLE,
+ gio::Cancellable::NONE,
)
.expect("checkout at");
@@ -38,7 +37,7 @@ fn should_checkout_at_with_default_options() {
dirfd.as_raw_fd(),
"test-checkout",
&checksum,
- NONE_CANCELLABLE,
+ gio::Cancellable::NONE,
)
.expect("checkout at");
@@ -65,7 +64,7 @@ fn should_checkout_at_with_options() {
dirfd.as_raw_fd(),
"test-checkout",
&checksum,
- NONE_CANCELLABLE,
+ gio::Cancellable::NONE,
)
.expect("checkout at");
@@ -98,7 +97,7 @@ fn should_checkout_at_with_filter() {
dirfd.as_raw_fd(),
"test-checkout",
&checksum,
- NONE_CANCELLABLE,
+ gio::Cancellable::NONE,
)
.expect("checkout at");
diff --git a/rust-bindings/tests/repo/generate_static.rs b/rust-bindings/tests/repo/generate_static.rs
index 297ce95d..f6b74028 100644
--- a/rust-bindings/tests/repo/generate_static.rs
+++ b/rust-bindings/tests/repo/generate_static.rs
@@ -1,5 +1,4 @@
use crate::util::*;
-use gio::NONE_CANCELLABLE;
use ostree::glib::prelude::*;
use ostree::glib::Variant;
use ostree::*;
@@ -36,7 +35,7 @@ fn should_generate_static_delta_at() {
&to,
None,
Some(varopts),
- NONE_CANCELLABLE,
+ gio::Cancellable::NONE,
)
.expect("static delta generate");
diff --git a/rust-bindings/tests/repo/mod.rs b/rust-bindings/tests/repo/mod.rs
index 0f8967a0..54ee7ac0 100644
--- a/rust-bindings/tests/repo/mod.rs
+++ b/rust-bindings/tests/repo/mod.rs
@@ -1,5 +1,4 @@
use crate::util::*;
-use ostree::gio::NONE_CANCELLABLE;
use ostree::prelude::*;
use ostree::{ObjectName, ObjectType};
@@ -19,9 +18,9 @@ fn should_commit_content_to_repo_and_list_refs_again() {
assert_eq!(test_repo.repo.require_rev("test").unwrap(), checksum);
let repo = ostree::Repo::new_for_path(test_repo.dir.path());
- repo.open(NONE_CANCELLABLE).expect("OSTree test_repo");
+ repo.open(gio::Cancellable::NONE).expect("OSTree test_repo");
let refs = repo
- .list_refs(None, NONE_CANCELLABLE)
+ .list_refs(None, gio::Cancellable::NONE)
.expect("failed to list refs");
assert_eq!(1, refs.len());
assert_eq!(checksum, refs["test"]);
@@ -29,7 +28,7 @@ fn should_commit_content_to_repo_and_list_refs_again() {
#[test]
fn list_commits() {
- let cancellable = gio::NONE_CANCELLABLE;
+ let cancellable = ostree::gio::Cancellable::NONE;
let test_repo = TestRepo::new();
for prefix in [None, Some("a"), Some("0abcde")] {
@@ -72,7 +71,7 @@ fn cap_std_commit() {
let repo2 = ostree::Repo::open_at_dir(&test_repo.dir, ".").unwrap();
let refs = repo2
- .list_refs(None, NONE_CANCELLABLE)
+ .list_refs(None, gio::Cancellable::NONE)
.expect("failed to list refs");
assert_eq!(1, refs.len());
assert_eq!(checksum, refs["test"]);
@@ -85,7 +84,7 @@ fn repo_traverse_and_read() {
let objects = test_repo
.repo
- .traverse_commit(&checksum, -1, NONE_CANCELLABLE)
+ .traverse_commit(&checksum, -1, gio::Cancellable::NONE)
.expect("traverse commit");
assert_eq!(
@@ -122,7 +121,7 @@ fn repo_traverse_and_read() {
.repo
.query_file(
"89f84ca9854a80e85b583e46a115ba4985254437027bad34f0b113219323d3f8",
- NONE_CANCELLABLE,
+ gio::Cancellable::NONE,
)
.unwrap();
assert_eq!(finfo.size(), 5);
@@ -136,13 +135,13 @@ fn should_checkout_tree() {
let checkout_dir = tempfile::tempdir().expect("checkout dir");
let file = test_repo
.repo
- .read_commit("test", NONE_CANCELLABLE)
+ .read_commit("test", gio::Cancellable::NONE)
.expect("read commit")
.0
.downcast::<ostree::RepoFile>()
.expect("RepoFile");
let info = file
- .query_info("*", gio::FileQueryInfoFlags::NONE, NONE_CANCELLABLE)
+ .query_info("*", gio::FileQueryInfoFlags::NONE, gio::Cancellable::NONE)
.expect("file info");
test_repo
.repo
@@ -152,7 +151,7 @@ fn should_checkout_tree() {
&gio::File::for_path(checkout_dir.path().join("test-checkout")),
&file,
&info,
- NONE_CANCELLABLE,
+ gio::Cancellable::NONE,
)
.expect("checkout tree");
@@ -168,7 +167,7 @@ fn should_write_content_to_repo() {
let dest = TestRepo::new();
let objects = src
.repo
- .traverse_commit(&checksum, -1, NONE_CANCELLABLE)
+ .traverse_commit(&checksum, -1, gio::Cancellable::NONE)
.expect("traverse");
for obj in objects {
match obj.object_type() {
@@ -192,11 +191,11 @@ fn repo_file() {
fn copy_file(src: &TestRepo, dest: &TestRepo, obj: &ObjectName) {
let (stream, len) = src
.repo
- .load_object_stream(obj.object_type(), obj.checksum(), NONE_CANCELLABLE)
+ .load_object_stream(obj.object_type(), obj.checksum(), gio::Cancellable::NONE)
.expect("load object stream");
let out_csum = dest
.repo
- .write_content(None, &stream, len, NONE_CANCELLABLE)
+ .write_content(None, &stream, len, gio::Cancellable::NONE)
.expect("write content");
assert_eq!(out_csum.to_string(), obj.checksum());
}
@@ -208,7 +207,7 @@ fn copy_metadata(src: &TestRepo, dest: &TestRepo, obj: &ObjectName) {
.expect("load variant");
let out_csum = dest
.repo
- .write_metadata(obj.object_type(), None, &data, NONE_CANCELLABLE)
+ .write_metadata(obj.object_type(), None, &data, gio::Cancellable::NONE)
.expect("write metadata");
assert_eq!(out_csum.to_string(), obj.checksum());
}
diff --git a/rust-bindings/tests/sign/mod.rs b/rust-bindings/tests/sign/mod.rs
index 300beedf..aa2a59a0 100644
--- a/rust-bindings/tests/sign/mod.rs
+++ b/rust-bindings/tests/sign/mod.rs
@@ -13,7 +13,7 @@ fn sign_api_should_work() {
let result = ostree::prelude::SignExt::data(
&dummy_sign,
&glib::Bytes::from_static(b"1234"),
- gio::NONE_CANCELLABLE,
+ gio::Cancellable::NONE,
);
assert!(result.is_err());
@@ -61,7 +61,7 @@ echo $ED25519SECRET > ed25519.secret
let payload = &glib::Bytes::from_static(b"1234");
- let signature = signer.data(payload, gio::NONE_CANCELLABLE).unwrap();
+ let signature = signer.data(payload, gio::Cancellable::NONE).unwrap();
let signatures = [&*signature].to_variant();
let msg = signer.data_verify(payload, &signatures).unwrap().unwrap();
diff --git a/rust-bindings/tests/util/mod.rs b/rust-bindings/tests/util/mod.rs
index c38daeec..80886910 100644
--- a/rust-bindings/tests/util/mod.rs
+++ b/rust-bindings/tests/util/mod.rs
@@ -1,4 +1,3 @@
-use gio::NONE_CANCELLABLE;
use glib::prelude::*;
use glib::GString;
use std::path::Path;
@@ -17,7 +16,7 @@ impl TestRepo {
pub fn new_with_mode(repo_mode: ostree::RepoMode) -> TestRepo {
let dir = tempfile::tempdir().expect("temp repo dir");
let repo = ostree::Repo::new_for_path(dir.path());
- repo.create(repo_mode, NONE_CANCELLABLE)
+ repo.create(repo_mode, gio::Cancellable::NONE)
.expect("OSTree repo");
TestRepo { dir, repo }
}
@@ -55,18 +54,18 @@ pub fn create_mtree(repo: &ostree::Repo) -> ostree::MutableTree {
let file = gio::File::for_path(
Path::new(env!("CARGO_MANIFEST_DIR")).join("rust-bindings/tests/data/test.tar"),
);
- repo.write_archive_to_mtree(&file, &mtree, None, true, NONE_CANCELLABLE)
+ repo.write_archive_to_mtree(&file, &mtree, None, true, gio::Cancellable::NONE)
.expect("test mtree");
mtree
}
pub fn commit(repo: &ostree::Repo, mtree: &ostree::MutableTree, ref_: &str) -> GString {
let txn = repo
- .auto_transaction(NONE_CANCELLABLE)
+ .auto_transaction(gio::Cancellable::NONE)
.expect("prepare transaction");
let repo_file = txn
.repo()
- .write_mtree(mtree, NONE_CANCELLABLE)
+ .write_mtree(mtree, gio::Cancellable::NONE)
.expect("write mtree")
.downcast::<ostree::RepoFile>()
.unwrap();
@@ -77,11 +76,12 @@ pub fn commit(repo: &ostree::Repo, mtree: &ostree::MutableTree, ref_: &str) -> G
None,
None,
&repo_file,
- NONE_CANCELLABLE,
+ gio::Cancellable::NONE,
)
.expect("write commit");
repo.transaction_set_ref(None, ref_, checksum.as_str().into());
- txn.commit(NONE_CANCELLABLE).expect("commit transaction");
+ txn.commit(gio::Cancellable::NONE)
+ .expect("commit transaction");
checksum
}