Merge pull request #2768 from cgwalters/update-gio

rust: Update to gio 0.16
This commit is contained in:
Colin Walters 2022-11-22 09:50:27 -05:00 committed by GitHub
commit 8c831311be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 1147 additions and 4019 deletions

View File

@ -42,8 +42,8 @@ bitflags = "1.2.1"
cap-std = { version = "1.0", optional = true}
io-lifetimes = { version = "1.0", optional = true}
ffi = { package = "ostree-sys", path = "rust-bindings/sys", version = "0.11.0" }
gio = "0.15"
glib = "0.15"
gio = "0.16"
glib = "0.16"
hex = "0.4.2"
libc = "0.2"
once_cell = "1.4.0"

View File

@ -1,5 +1,5 @@
GIR_REPO := https://github.com/gtk-rs/gir.git
GIR_VERSION := c8a7a13d2c4d3a57ae646e38a821d57243cf7983
GIR_VERSION := e94fdc6499e45d89bada123f4d2e63ceb6af997d
OSTREE_REPO := ../ostree
OSTREE_VERSION := patch-v2022.2
RUSTDOC_STRIPPER_VERSION := 0.1.17

View File

@ -22,11 +22,13 @@ 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")]
//pub fn new_and_connect(changed: /*Unimplemented*/Option<Fundamental: Pointer>, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> AsyncProgress {
//pub fn new_and_connect(changed: /*Unimplemented*/Option<Basic: Pointer>, user_data: /*Unimplemented*/Option<Basic: Pointer>) -> AsyncProgress {
// unsafe { TODO: call ffi:ostree_async_progress_new_and_connect() }
//}
@ -49,7 +51,7 @@ impl AsyncProgress {
//#[cfg(any(feature = "v2017_6", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_6")))]
//#[doc(alias = "ostree_async_progress_get")]
//pub fn get(&self, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
//pub fn get(&self, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
// unsafe { TODO: call ffi:ostree_async_progress_get() }
//}
@ -58,13 +60,17 @@ 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")]
@ -81,17 +87,14 @@ 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))
}
}
//#[cfg(any(feature = "v2017_6", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_6")))]
//#[doc(alias = "ostree_async_progress_set")]
//pub fn set(&self, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
//pub fn set(&self, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
// unsafe { TODO: call ffi:ostree_async_progress_set() }
//}
@ -114,11 +117,7 @@ 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);
}
}
@ -127,42 +126,29 @@ 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))
}
}
}
impl Default for AsyncProgress {
fn default() -> Self {
Self::new()
}
}
fn default() -> Self {
Self::new()
}
}
impl fmt::Display for AsyncProgress {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

View File

@ -19,22 +19,23 @@ 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]
#[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,68 +45,34 @@ 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(
&self,
path: &impl IsA<gio::File>,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[doc(alias = "ostree_bootconfig_parser_parse_at")]
pub fn parse_at(
&self,
dfd: i32,
path: &str,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> Result<(), glib::Error> {
pub fn parse_at(&self, dfd: i32, path: &str, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let is_ok = ffi::ostree_bootconfig_parser_parse_at(
self.to_glib_none().0,
dfd,
path.to_glib_none().0,
cancellable.map(|p| p.as_ref()).to_glib_none().0,
&mut error,
);
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))
}
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);
}
}
@ -114,67 +81,36 @@ 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(
&self,
output: &impl IsA<gio::File>,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[doc(alias = "ostree_bootconfig_parser_write_at")]
pub fn write_at(
&self,
dfd: i32,
path: &str,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> Result<(), glib::Error> {
pub fn write_at(&self, dfd: i32, path: &str, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let is_ok = ffi::ostree_bootconfig_parser_write_at(
self.to_glib_none().0,
dfd,
path.to_glib_none().0,
cancellable.map(|p| p.as_ref()).to_glib_none().0,
&mut error,
);
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
}
impl Default for BootconfigParser {
fn default() -> Self {
Self::new()
}
}
fn default() -> Self {
Self::new()
}
}
impl fmt::Display for BootconfigParser {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

View File

@ -20,32 +20,21 @@ 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 {
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 {
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)
}
}
}
@ -61,10 +50,7 @@ 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)
}
}

View File

@ -18,19 +18,9 @@ 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))
}
}
}

View File

@ -5,175 +5,72 @@
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()});

View File

@ -18,22 +18,11 @@ glib::wrapper! {
impl ContentWriter {
#[doc(alias = "ostree_content_writer_finish")]
pub fn finish(
&self,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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)) }
}
}
}

View File

@ -20,100 +20,97 @@ 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 {
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,
))
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]
#[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"))]
@ -121,16 +118,15 @@ 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)
}
}
@ -138,23 +134,24 @@ 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);
}
}
@ -193,9 +190,7 @@ 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()))
}
}
}

View File

@ -2,6 +2,7 @@
// from gir-files
// DO NOT EDIT
glib::wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct DiffItem(Shared<ffi::OstreeDiffItem>);

View File

@ -5,7 +5,8 @@
use glib::translate::*;
use std::fmt;
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeDeploymentUnlockedState")]
pub enum DeploymentUnlockedState {
@ -17,23 +18,19 @@ 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",
})
}
}
@ -48,7 +45,7 @@ impl IntoGlib for DeploymentUnlockedState {
Self::Hotfix => ffi::OSTREE_DEPLOYMENT_UNLOCKED_HOTFIX,
Self::Transient => ffi::OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT,
Self::__Unknown(value) => value,
}
}
}
}
@ -61,11 +58,12 @@ 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, Clone, Copy)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeGpgSignatureAttr")]
pub enum GpgSignatureAttr {
@ -99,34 +97,30 @@ 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",
})
}
}
@ -150,11 +144,9 @@ 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,
}
}
}
}
@ -176,15 +168,14 @@ 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, Clone, Copy)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeObjectType")]
pub enum ObjectType {
@ -206,28 +197,24 @@ 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",
})
}
}
@ -247,7 +234,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,
}
}
}
}
@ -265,13 +252,14 @@ 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, Clone, Copy)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeRepoCheckoutFilterResult")]
pub enum RepoCheckoutFilterResult {
@ -279,7 +267,7 @@ pub enum RepoCheckoutFilterResult {
Allow,
#[doc(alias = "OSTREE_REPO_CHECKOUT_FILTER_SKIP")]
Skip,
#[doc(hidden)]
#[doc(hidden)]
__Unknown(i32),
}
@ -287,15 +275,11 @@ 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",
})
}
}
@ -310,7 +294,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,
}
}
}
}
@ -323,11 +307,12 @@ 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, Clone, Copy)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeRepoCheckoutMode")]
pub enum RepoCheckoutMode {
@ -335,21 +320,17 @@ 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",
})
}
}
@ -362,7 +343,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,
}
}
}
}
@ -373,11 +354,12 @@ 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, Clone, Copy)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeRepoCheckoutOverwriteMode")]
pub enum RepoCheckoutOverwriteMode {
@ -389,23 +371,19 @@ 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",
})
}
}
@ -420,7 +398,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,
}
}
}
}
@ -433,11 +411,12 @@ 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, Clone, Copy)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeRepoCommitFilterResult")]
pub enum RepoCommitFilterResult {
@ -445,21 +424,17 @@ 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",
})
}
}
@ -472,7 +447,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,
}
}
}
}
@ -483,11 +458,12 @@ 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, Clone, Copy)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeRepoCommitIterResult")]
pub enum RepoCommitIterResult {
@ -499,23 +475,19 @@ 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",
})
}
}
@ -530,7 +502,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,
}
}
}
}
@ -543,11 +515,12 @@ 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, Clone, Copy)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeRepoMode")]
pub enum RepoMode {
@ -561,24 +534,20 @@ 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",
})
}
}
@ -594,7 +563,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,
}
}
}
}
@ -608,11 +577,12 @@ 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, Clone, Copy)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeRepoRemoteChange")]
pub enum RepoRemoteChange {
@ -626,24 +596,20 @@ 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",
})
}
}
@ -659,7 +625,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,
}
}
}
}
@ -673,11 +639,12 @@ 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, Clone, Copy)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "OstreeStaticDeltaGenerateOpt")]
pub enum StaticDeltaGenerateOpt {
@ -685,21 +652,17 @@ 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",
})
}
}
@ -712,7 +675,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,
}
}
}
}
@ -723,6 +686,7 @@ 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),
}
}
}
}

View File

@ -16,11 +16,11 @@ bitflags! {
#[doc(alias = "OstreeChecksumFlags")]
pub struct ChecksumFlags: u32 {
#[doc(alias = "OSTREE_CHECKSUM_FLAGS_NONE")]
const NONE = ffi::OSTREE_CHECKSUM_FLAGS_NONE as u32;
const NONE = ffi::OSTREE_CHECKSUM_FLAGS_NONE as _;
#[doc(alias = "OSTREE_CHECKSUM_FLAGS_IGNORE_XATTRS")]
const IGNORE_XATTRS = ffi::OSTREE_CHECKSUM_FLAGS_IGNORE_XATTRS as u32;
const IGNORE_XATTRS = ffi::OSTREE_CHECKSUM_FLAGS_IGNORE_XATTRS as _;
#[doc(alias = "OSTREE_CHECKSUM_FLAGS_CANONICAL_PERMISSIONS")]
const CANONICAL_PERMISSIONS = ffi::OSTREE_CHECKSUM_FLAGS_CANONICAL_PERMISSIONS as u32;
const CANONICAL_PERMISSIONS = ffi::OSTREE_CHECKSUM_FLAGS_CANONICAL_PERMISSIONS as _;
}
}
@ -56,9 +56,9 @@ bitflags! {
#[doc(alias = "OstreeDiffFlags")]
pub struct DiffFlags: u32 {
#[doc(alias = "OSTREE_DIFF_FLAGS_NONE")]
const NONE = ffi::OSTREE_DIFF_FLAGS_NONE as u32;
const NONE = ffi::OSTREE_DIFF_FLAGS_NONE as _;
#[doc(alias = "OSTREE_DIFF_FLAGS_IGNORE_XATTRS")]
const IGNORE_XATTRS = ffi::OSTREE_DIFF_FLAGS_IGNORE_XATTRS as u32;
const IGNORE_XATTRS = ffi::OSTREE_DIFF_FLAGS_IGNORE_XATTRS as _;
}
}
@ -88,7 +88,7 @@ bitflags! {
#[doc(alias = "OstreeGpgSignatureFormatFlags")]
pub struct GpgSignatureFormatFlags: u32 {
#[doc(alias = "OSTREE_GPG_SIGNATURE_FORMAT_DEFAULT")]
const GPG_SIGNATURE_FORMAT_DEFAULT = ffi::OSTREE_GPG_SIGNATURE_FORMAT_DEFAULT as u32;
const GPG_SIGNATURE_FORMAT_DEFAULT = ffi::OSTREE_GPG_SIGNATURE_FORMAT_DEFAULT as _;
}
}
@ -118,19 +118,19 @@ bitflags! {
#[doc(alias = "OstreeRepoCommitModifierFlags")]
pub struct RepoCommitModifierFlags: u32 {
#[doc(alias = "OSTREE_REPO_COMMIT_MODIFIER_FLAGS_NONE")]
const NONE = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_NONE as u32;
const NONE = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_NONE as _;
#[doc(alias = "OSTREE_REPO_COMMIT_MODIFIER_FLAGS_SKIP_XATTRS")]
const SKIP_XATTRS = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_SKIP_XATTRS as u32;
const SKIP_XATTRS = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_SKIP_XATTRS as _;
#[doc(alias = "OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES")]
const GENERATE_SIZES = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES as u32;
const GENERATE_SIZES = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES as _;
#[doc(alias = "OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CANONICAL_PERMISSIONS")]
const CANONICAL_PERMISSIONS = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CANONICAL_PERMISSIONS as u32;
const CANONICAL_PERMISSIONS = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CANONICAL_PERMISSIONS as _;
#[doc(alias = "OSTREE_REPO_COMMIT_MODIFIER_FLAGS_ERROR_ON_UNLABELED")]
const ERROR_ON_UNLABELED = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_ERROR_ON_UNLABELED as u32;
const ERROR_ON_UNLABELED = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_ERROR_ON_UNLABELED as _;
#[doc(alias = "OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CONSUME")]
const CONSUME = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CONSUME as u32;
const CONSUME = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CONSUME as _;
#[doc(alias = "OSTREE_REPO_COMMIT_MODIFIER_FLAGS_DEVINO_CANONICAL")]
const DEVINO_CANONICAL = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_DEVINO_CANONICAL as u32;
const DEVINO_CANONICAL = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_DEVINO_CANONICAL as _;
}
}
@ -162,11 +162,11 @@ bitflags! {
#[doc(alias = "OstreeRepoCommitState")]
pub struct RepoCommitState: u32 {
#[doc(alias = "OSTREE_REPO_COMMIT_STATE_NORMAL")]
const NORMAL = ffi::OSTREE_REPO_COMMIT_STATE_NORMAL as u32;
const NORMAL = ffi::OSTREE_REPO_COMMIT_STATE_NORMAL as _;
#[doc(alias = "OSTREE_REPO_COMMIT_STATE_PARTIAL")]
const PARTIAL = ffi::OSTREE_REPO_COMMIT_STATE_PARTIAL as u32;
const PARTIAL = ffi::OSTREE_REPO_COMMIT_STATE_PARTIAL as _;
#[doc(alias = "OSTREE_REPO_COMMIT_STATE_FSCK_PARTIAL")]
const FSCK_PARTIAL = ffi::OSTREE_REPO_COMMIT_STATE_FSCK_PARTIAL as u32;
const FSCK_PARTIAL = ffi::OSTREE_REPO_COMMIT_STATE_FSCK_PARTIAL as _;
}
}
@ -202,9 +202,9 @@ bitflags! {
#[doc(alias = "OstreeRepoCommitTraverseFlags")]
pub struct RepoCommitTraverseFlags: u32 {
#[doc(alias = "OSTREE_REPO_COMMIT_TRAVERSE_FLAG_NONE")]
const NONE = ffi::OSTREE_REPO_COMMIT_TRAVERSE_FLAG_NONE as u32;
const NONE = ffi::OSTREE_REPO_COMMIT_TRAVERSE_FLAG_NONE as _;
#[doc(alias = "OSTREE_REPO_COMMIT_TRAVERSE_FLAG_COMMIT_ONLY")]
const COMMIT_ONLY = ffi::OSTREE_REPO_COMMIT_TRAVERSE_FLAG_COMMIT_ONLY as u32;
const COMMIT_ONLY = ffi::OSTREE_REPO_COMMIT_TRAVERSE_FLAG_COMMIT_ONLY as _;
}
}
@ -234,13 +234,13 @@ bitflags! {
#[doc(alias = "OstreeRepoListObjectsFlags")]
pub struct RepoListObjectsFlags: u32 {
#[doc(alias = "OSTREE_REPO_LIST_OBJECTS_LOOSE")]
const LOOSE = ffi::OSTREE_REPO_LIST_OBJECTS_LOOSE as u32;
const LOOSE = ffi::OSTREE_REPO_LIST_OBJECTS_LOOSE as _;
#[doc(alias = "OSTREE_REPO_LIST_OBJECTS_PACKED")]
const PACKED = ffi::OSTREE_REPO_LIST_OBJECTS_PACKED as u32;
const PACKED = ffi::OSTREE_REPO_LIST_OBJECTS_PACKED as _;
#[doc(alias = "OSTREE_REPO_LIST_OBJECTS_ALL")]
const ALL = ffi::OSTREE_REPO_LIST_OBJECTS_ALL as u32;
const ALL = ffi::OSTREE_REPO_LIST_OBJECTS_ALL as _;
#[doc(alias = "OSTREE_REPO_LIST_OBJECTS_NO_PARENTS")]
const NO_PARENTS = ffi::OSTREE_REPO_LIST_OBJECTS_NO_PARENTS as u32;
const NO_PARENTS = ffi::OSTREE_REPO_LIST_OBJECTS_NO_PARENTS as _;
}
}
@ -270,13 +270,13 @@ bitflags! {
#[doc(alias = "OstreeRepoListRefsExtFlags")]
pub struct RepoListRefsExtFlags: u32 {
#[doc(alias = "OSTREE_REPO_LIST_REFS_EXT_NONE")]
const NONE = ffi::OSTREE_REPO_LIST_REFS_EXT_NONE as u32;
const NONE = ffi::OSTREE_REPO_LIST_REFS_EXT_NONE as _;
#[doc(alias = "OSTREE_REPO_LIST_REFS_EXT_ALIASES")]
const ALIASES = ffi::OSTREE_REPO_LIST_REFS_EXT_ALIASES as u32;
const ALIASES = ffi::OSTREE_REPO_LIST_REFS_EXT_ALIASES as _;
#[doc(alias = "OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES")]
const EXCLUDE_REMOTES = ffi::OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES as u32;
const EXCLUDE_REMOTES = ffi::OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES as _;
#[doc(alias = "OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS")]
const EXCLUDE_MIRRORS = ffi::OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS as u32;
const EXCLUDE_MIRRORS = ffi::OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS as _;
}
}
@ -306,13 +306,13 @@ bitflags! {
#[doc(alias = "OstreeRepoPruneFlags")]
pub struct RepoPruneFlags: u32 {
#[doc(alias = "OSTREE_REPO_PRUNE_FLAGS_NONE")]
const NONE = ffi::OSTREE_REPO_PRUNE_FLAGS_NONE as u32;
const NONE = ffi::OSTREE_REPO_PRUNE_FLAGS_NONE as _;
#[doc(alias = "OSTREE_REPO_PRUNE_FLAGS_NO_PRUNE")]
const NO_PRUNE = ffi::OSTREE_REPO_PRUNE_FLAGS_NO_PRUNE as u32;
const NO_PRUNE = ffi::OSTREE_REPO_PRUNE_FLAGS_NO_PRUNE as _;
#[doc(alias = "OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY")]
const REFS_ONLY = ffi::OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY as u32;
const REFS_ONLY = ffi::OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY as _;
#[doc(alias = "OSTREE_REPO_PRUNE_FLAGS_COMMIT_ONLY")]
const COMMIT_ONLY = ffi::OSTREE_REPO_PRUNE_FLAGS_COMMIT_ONLY as u32;
const COMMIT_ONLY = ffi::OSTREE_REPO_PRUNE_FLAGS_COMMIT_ONLY as _;
}
}
@ -342,17 +342,17 @@ bitflags! {
#[doc(alias = "OstreeRepoPullFlags")]
pub struct RepoPullFlags: u32 {
#[doc(alias = "OSTREE_REPO_PULL_FLAGS_NONE")]
const NONE = ffi::OSTREE_REPO_PULL_FLAGS_NONE as u32;
const NONE = ffi::OSTREE_REPO_PULL_FLAGS_NONE as _;
#[doc(alias = "OSTREE_REPO_PULL_FLAGS_MIRROR")]
const MIRROR = ffi::OSTREE_REPO_PULL_FLAGS_MIRROR as u32;
const MIRROR = ffi::OSTREE_REPO_PULL_FLAGS_MIRROR as _;
#[doc(alias = "OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY")]
const COMMIT_ONLY = ffi::OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY as u32;
const COMMIT_ONLY = ffi::OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY as _;
#[doc(alias = "OSTREE_REPO_PULL_FLAGS_UNTRUSTED")]
const UNTRUSTED = ffi::OSTREE_REPO_PULL_FLAGS_UNTRUSTED as u32;
const UNTRUSTED = ffi::OSTREE_REPO_PULL_FLAGS_UNTRUSTED as _;
#[doc(alias = "OSTREE_REPO_PULL_FLAGS_BAREUSERONLY_FILES")]
const BAREUSERONLY_FILES = ffi::OSTREE_REPO_PULL_FLAGS_BAREUSERONLY_FILES as u32;
const BAREUSERONLY_FILES = ffi::OSTREE_REPO_PULL_FLAGS_BAREUSERONLY_FILES as _;
#[doc(alias = "OSTREE_REPO_PULL_FLAGS_TRUSTED_HTTP")]
const TRUSTED_HTTP = ffi::OSTREE_REPO_PULL_FLAGS_TRUSTED_HTTP as u32;
const TRUSTED_HTTP = ffi::OSTREE_REPO_PULL_FLAGS_TRUSTED_HTTP as _;
}
}
@ -382,9 +382,9 @@ bitflags! {
#[doc(alias = "OstreeRepoResolveRevExtFlags")]
pub struct RepoResolveRevExtFlags: u32 {
#[doc(alias = "OSTREE_REPO_RESOLVE_REV_EXT_NONE")]
const NONE = ffi::OSTREE_REPO_RESOLVE_REV_EXT_NONE as u32;
const NONE = ffi::OSTREE_REPO_RESOLVE_REV_EXT_NONE as _;
#[doc(alias = "OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY")]
const LOCAL_ONLY = ffi::OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY as u32;
const LOCAL_ONLY = ffi::OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY as _;
}
}
@ -416,11 +416,11 @@ bitflags! {
#[doc(alias = "OstreeRepoVerifyFlags")]
pub struct RepoVerifyFlags: u32 {
#[doc(alias = "OSTREE_REPO_VERIFY_FLAGS_NONE")]
const NONE = ffi::OSTREE_REPO_VERIFY_FLAGS_NONE as u32;
const NONE = ffi::OSTREE_REPO_VERIFY_FLAGS_NONE as _;
#[doc(alias = "OSTREE_REPO_VERIFY_FLAGS_NO_GPG")]
const NO_GPG = ffi::OSTREE_REPO_VERIFY_FLAGS_NO_GPG as u32;
const NO_GPG = ffi::OSTREE_REPO_VERIFY_FLAGS_NO_GPG as _;
#[doc(alias = "OSTREE_REPO_VERIFY_FLAGS_NO_SIGNAPI")]
const NO_SIGNAPI = ffi::OSTREE_REPO_VERIFY_FLAGS_NO_SIGNAPI as u32;
const NO_SIGNAPI = ffi::OSTREE_REPO_VERIFY_FLAGS_NO_SIGNAPI as _;
}
}
@ -456,11 +456,11 @@ bitflags! {
#[doc(alias = "OstreeSePolicyRestoreconFlags")]
pub struct SePolicyRestoreconFlags: u32 {
#[doc(alias = "OSTREE_SEPOLICY_RESTORECON_FLAGS_NONE")]
const NONE = ffi::OSTREE_SEPOLICY_RESTORECON_FLAGS_NONE as u32;
const NONE = ffi::OSTREE_SEPOLICY_RESTORECON_FLAGS_NONE as _;
#[doc(alias = "OSTREE_SEPOLICY_RESTORECON_FLAGS_ALLOW_NOLABEL")]
const ALLOW_NOLABEL = ffi::OSTREE_SEPOLICY_RESTORECON_FLAGS_ALLOW_NOLABEL as u32;
const ALLOW_NOLABEL = ffi::OSTREE_SEPOLICY_RESTORECON_FLAGS_ALLOW_NOLABEL as _;
#[doc(alias = "OSTREE_SEPOLICY_RESTORECON_FLAGS_KEEP_EXISTING")]
const KEEP_EXISTING = ffi::OSTREE_SEPOLICY_RESTORECON_FLAGS_KEEP_EXISTING as u32;
const KEEP_EXISTING = ffi::OSTREE_SEPOLICY_RESTORECON_FLAGS_KEEP_EXISTING as _;
}
}
@ -490,17 +490,17 @@ bitflags! {
#[doc(alias = "OstreeSysrootSimpleWriteDeploymentFlags")]
pub struct SysrootSimpleWriteDeploymentFlags: u32 {
#[doc(alias = "OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NONE")]
const NONE = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NONE as u32;
const NONE = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NONE as _;
#[doc(alias = "OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN")]
const RETAIN = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN as u32;
const RETAIN = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN as _;
#[doc(alias = "OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NOT_DEFAULT")]
const NOT_DEFAULT = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NOT_DEFAULT as u32;
const NOT_DEFAULT = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NOT_DEFAULT as _;
#[doc(alias = "OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NO_CLEAN")]
const NO_CLEAN = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NO_CLEAN as u32;
const NO_CLEAN = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NO_CLEAN as _;
#[doc(alias = "OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN_PENDING")]
const RETAIN_PENDING = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN_PENDING as u32;
const RETAIN_PENDING = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN_PENDING as _;
#[doc(alias = "OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN_ROLLBACK")]
const RETAIN_ROLLBACK = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN_ROLLBACK as u32;
const RETAIN_ROLLBACK = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN_ROLLBACK as _;
}
}
@ -530,9 +530,9 @@ bitflags! {
#[doc(alias = "OstreeSysrootUpgraderFlags")]
pub struct SysrootUpgraderFlags: u32 {
#[doc(alias = "OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED")]
const IGNORE_UNCONFIGURED = ffi::OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED as u32;
const IGNORE_UNCONFIGURED = ffi::OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED as _;
#[doc(alias = "OSTREE_SYSROOT_UPGRADER_FLAGS_STAGE")]
const STAGE = ffi::OSTREE_SYSROOT_UPGRADER_FLAGS_STAGE as u32;
const STAGE = ffi::OSTREE_SYSROOT_UPGRADER_FLAGS_STAGE as _;
}
}
@ -594,11 +594,11 @@ bitflags! {
#[doc(alias = "OstreeSysrootUpgraderPullFlags")]
pub struct SysrootUpgraderPullFlags: u32 {
#[doc(alias = "OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_NONE")]
const NONE = ffi::OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_NONE as u32;
const NONE = ffi::OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_NONE as _;
#[doc(alias = "OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_ALLOW_OLDER")]
const ALLOW_OLDER = ffi::OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_ALLOW_OLDER as u32;
const ALLOW_OLDER = ffi::OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_ALLOW_OLDER as _;
#[doc(alias = "OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_SYNTHETIC")]
const SYNTHETIC = ffi::OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_SYNTHETIC as u32;
const SYNTHETIC = ffi::OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_SYNTHETIC as _;
}
}
@ -623,3 +623,4 @@ impl FromGlib<ffi::OstreeSysrootUpgraderPullFlags> for SysrootUpgraderPullFlags
Self::from_bits_truncate(value)
}
}

View File

@ -13,30 +13,16 @@ 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(
dfd: i32,
path: &str,
skip_xattrs: bool,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -44,7 +30,9 @@ pub fn break_hardlink(
#[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")]
@ -59,12 +47,16 @@ 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"))]
@ -72,41 +64,27 @@ 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 is_ok = ffi::ostree_commit_get_object_sizes(
commit_variant.to_glib_none().0,
&mut out_sizes_entries,
&mut 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))
}
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))
}
}
@ -114,7 +92,9 @@ 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"))]
@ -125,155 +105,58 @@ pub fn commit_get_timestamp(commit_variant: &glib::Variant) -> u64 {
//}
#[doc(alias = "ostree_content_file_parse")]
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> {
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 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,
);
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))
}
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(
compressed: bool,
parent_dfd: i32,
path: &str,
trusted: bool,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
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(
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> {
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 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,
);
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))
}
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(
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> {
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 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,
);
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -285,63 +168,27 @@ pub fn diff_dirs(
//}
#[doc(alias = "ostree_diff_print")]
pub fn diff_print(
a: &impl IsA<gio::File>,
b: &impl IsA<gio::File>,
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(
fd: i32,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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(
dfd: i32,
path: &str,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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)) }
}
}
@ -349,12 +196,16 @@ pub fn fs_get_all_xattrs_at(
#[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")]
@ -362,13 +213,8 @@ 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(),
);
let out_objtype = out_objtype.assume_init();
(from_glib_full(out_checksum), from_glib(out_objtype))
ffi::ostree_object_from_string(str.to_glib_none().0, &mut out_checksum, out_objtype.as_mut_ptr());
(from_glib_full(out_checksum), from_glib(out_objtype.assume_init()))
}
}
@ -377,44 +223,37 @@ 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(),
);
let out_objtype = out_objtype.assume_init();
(from_glib_none(out_checksum), from_glib(out_objtype))
ffi::ostree_object_name_deserialize(variant.to_glib_none().0, &mut out_checksum, out_objtype.as_mut_ptr());
(from_glib_none(out_checksum), from_glib(out_objtype.assume_init()))
}
}
#[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")]
@ -423,108 +262,47 @@ 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 is_ok = ffi::ostree_parse_refspec(
refspec.to_glib_none().0,
&mut out_remote,
&mut out_ref,
&mut 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))
}
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(
input: &impl IsA<gio::InputStream>,
file_info: &gio::FileInfo,
xattrs: Option<&glib::Variant>,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
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(
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> {
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 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,
);
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))
}
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(
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> {
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 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();
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);
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))
}
if error.is_null() { Ok((from_glib_full(out_input), out_length.assume_init())) } else { Err(from_glib_full(error)) }
}
}
@ -534,11 +312,7 @@ pub fn validate_checksum_string(sha256: &str) -> Result<(), glib::Error> {
let mut error = ptr::null_mut();
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -550,11 +324,7 @@ pub fn validate_collection_id(collection_id: Option<&str>) -> Result<(), glib::E
let mut error = ptr::null_mut();
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -566,11 +336,7 @@ pub fn validate_remote_name(remote_name: &str) -> Result<(), glib::Error> {
let mut error = ptr::null_mut();
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -580,11 +346,7 @@ pub fn validate_rev(rev: &str) -> Result<(), glib::Error> {
let mut error = ptr::null_mut();
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -592,14 +354,9 @@ 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 is_ok =
ffi::ostree_validate_structureof_checksum_string(checksum.to_glib_none().0, &mut 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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -609,11 +366,7 @@ pub fn validate_structureof_commit(commit: &glib::Variant) -> Result<(), glib::E
let mut error = ptr::null_mut();
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -623,11 +376,7 @@ pub fn validate_structureof_csum_v(checksum: &glib::Variant) -> Result<(), glib:
let mut error = ptr::null_mut();
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -637,11 +386,7 @@ pub fn validate_structureof_dirmeta(dirmeta: &glib::Variant) -> Result<(), glib:
let mut error = ptr::null_mut();
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -651,11 +396,7 @@ pub fn validate_structureof_dirtree(dirtree: &glib::Variant) -> Result<(), glib:
let mut error = ptr::null_mut();
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -665,11 +406,7 @@ pub fn validate_structureof_file_mode(mode: u32) -> Result<(), glib::Error> {
let mut error = ptr::null_mut();
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -679,10 +416,6 @@ pub fn validate_structureof_objtype(objtype: u8) -> Result<(), glib::Error> {
let mut error = ptr::null_mut();
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}

View File

@ -21,12 +21,16 @@ 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) }
unsafe {
ffi::ostree_gpg_verify_result_count_valid(self.to_glib_none().0)
}
}
//#[doc(alias = "ostree_gpg_verify_result_get")]
@ -38,10 +42,7 @@ 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))
}
}
@ -49,17 +50,8 @@ 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 out_signature_index = out_signature_index.assume_init();
if ret {
Some(out_signature_index)
} else {
None
}
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()));
if ret { Some(out_signature_index.assume_init()) } else { None }
}
}
@ -69,16 +61,9 @@ impl GpgVerifyResult {
pub fn require_valid_signature(&self) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let is_ok = ffi::ostree_gpg_verify_result_require_valid_signature(
self.to_glib_none().0,
&mut error,
);
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
}

View File

@ -21,24 +21,18 @@ 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))
}
}
@ -49,16 +43,8 @@ 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)) }
}
}
@ -70,11 +56,7 @@ impl MutableTree {
let mut error = ptr::null_mut();
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -83,62 +65,29 @@ impl MutableTree {
unsafe {
let mut out_subdir = ptr::null_mut();
let mut error = ptr::null_mut();
let is_ok = ffi::ostree_mutable_tree_ensure_dir(
self.to_glib_none().0,
name.to_glib_none().0,
&mut out_subdir,
&mut 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))
}
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 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,
);
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))
}
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))
}
}
@ -146,9 +95,7 @@ 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))
}
}
@ -162,9 +109,7 @@ 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))
}
}
@ -175,30 +120,14 @@ 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 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,
);
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))
}
if error.is_null() { Ok((from_glib_full(out_file_checksum), from_glib_full(out_subdir))) } else { Err(from_glib_full(error)) }
}
}
@ -208,18 +137,9 @@ impl MutableTree {
pub fn remove(&self, name: &str, allow_noent: bool) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let is_ok = ffi::ostree_mutable_tree_remove(
self.to_glib_none().0,
name.to_glib_none().0,
allow_noent.into_glib(),
&mut 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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -227,38 +147,23 @@ impl MutableTree {
pub fn replace_file(&self, name: &str, checksum: &str) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
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,
);
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))
}
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);
}
}
@ -267,28 +172,18 @@ impl MutableTree {
unsafe {
let mut out_subdir = ptr::null_mut();
let mut error = ptr::null_mut();
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,
);
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))
}
if error.is_null() { Ok(from_glib_full(out_subdir)) } else { Err(from_glib_full(error)) }
}
}
}
impl Default for MutableTree {
fn default() -> Self {
Self::new()
}
}
fn default() -> Self {
Self::new()
}
}
impl fmt::Display for MutableTree {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

View File

@ -19,12 +19,16 @@ 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))
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -31,27 +31,13 @@ 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 {
@ -59,29 +45,14 @@ 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))
}
}
@ -90,64 +61,33 @@ 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(
&self,
repo: &Repo,
rev: &str,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
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);
@ -156,22 +96,13 @@ 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 _);
}
}
}

View File

@ -18,12 +18,14 @@ 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())
}
}
}
impl Default for RepoDevInoCache {
fn default() -> Self {
Self::new()
}
}
fn default() -> Self {
Self::new()
}
}

View File

@ -25,54 +25,44 @@ impl RepoFile {
let mut error = ptr::null_mut();
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))
}
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]
#[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(
&self,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
if error.is_null() { Ok(from_glib_full(out_xattrs)) } else { Err(from_glib_full(error)) }
}
}
@ -81,90 +71,54 @@ 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 is_dir = is_dir.assume_init();
(ret, from_glib(is_dir), from_glib_full(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);
(ret, from_glib(is_dir.assume_init()), from_glib_full(out_container))
}
}
#[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(
&self,
n: i32,
attributes: &str,
flags: gio::FileQueryInfoFlags,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
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);
}
}
}

View File

@ -24,7 +24,8 @@ glib::wrapper! {
}
impl RepoFinder {
pub const NONE: Option<&'static RepoFinder> = None;
pub const NONE: Option<&'static RepoFinder> = None;
}
pub trait RepoFinderExt: 'static {}

View File

@ -22,7 +22,9 @@ impl RepoFinderAvahi {
#[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)) }
unsafe {
from_glib_full(ffi::ostree_repo_finder_avahi_new(context.to_glib_none().0))
}
}
#[cfg(any(feature = "v2018_6", feature = "dox"))]

View File

@ -22,17 +22,19 @@ impl RepoFinderConfig {
#[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())
}
}
}
#[cfg(any(feature = "v2018_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
impl Default for RepoFinderConfig {
fn default() -> Self {
Self::new()
}
}
fn default() -> Self {
Self::new()
}
}
impl fmt::Display for RepoFinderConfig {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

View File

@ -32,9 +32,7 @@ impl RepoFinderMount {
#[doc(alias = "ostree_repo_finder_mount_new")]
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))
}
}

View File

@ -22,7 +22,9 @@ impl RepoFinderOverride {
#[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"))]
@ -38,10 +40,10 @@ impl RepoFinderOverride {
#[cfg(any(feature = "v2018_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
impl Default for RepoFinderOverride {
fn default() -> Self {
Self::new()
}
}
fn default() -> Self {
Self::new()
}
}
impl fmt::Display for RepoFinderOverride {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

View File

@ -23,8 +23,10 @@ impl RepoFinderResult {
//}
#[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) }
fn compare(&self, b: &RepoFinderResult) -> i32 {
unsafe {
ffi::ostree_repo_finder_result_compare(self.to_glib_none().0, b.to_glib_none().0)
}
}
}

View File

@ -22,67 +22,32 @@ glib::wrapper! {
impl SePolicy {
#[doc(alias = "ostree_sepolicy_new")]
pub fn new(
path: &impl IsA<gio::File>,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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(
rootfs_dfd: i32,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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(
repo: &Repo,
rev: &str,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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)) }
}
}
@ -91,77 +56,47 @@ 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(
&self,
relpath: &str,
unix_mode: u32,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
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(
&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> {
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 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,
);
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))
}
if error.is_null() { Ok(from_glib_full(out_new_label)) } else { Err(from_glib_full(error)) }
}
}
@ -169,18 +104,9 @@ impl SePolicy {
pub fn setfscreatecon(&self, path: &str, mode: u32) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let is_ok = ffi::ostree_sepolicy_setfscreatecon(
self.to_glib_none().0,
path.to_glib_none().0,
mode,
&mut 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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}

View File

@ -24,14 +24,17 @@ glib::wrapper! {
}
impl Sign {
pub const NONE: Option<&'static Sign> = None;
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"))]
@ -42,11 +45,7 @@ impl Sign {
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)) }
}
}
}
@ -65,40 +64,22 @@ pub trait SignExt: 'static {
#[cfg(any(feature = "v2020_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_commit")]
fn commit(
&self,
repo: &Repo,
commit_checksum: &str,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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(
&self,
repo: &Repo,
commit_checksum: &str,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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(
&self,
data: &glib::Bytes,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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")))]
@ -134,12 +115,7 @@ pub trait SignExt: 'static {
#[cfg(any(feature = "v2020_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_summary")]
fn summary(
&self,
repo: &Repo,
keys: &glib::Variant,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 {
@ -148,17 +124,9 @@ impl<O: IsA<Sign>> SignExt for O {
fn add_pk(&self, public_key: &glib::Variant) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let is_ok = ffi::ostree_sign_add_pk(
self.as_ref().to_glib_none().0,
public_key.to_glib_none().0,
&mut 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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -169,124 +137,63 @@ impl<O: IsA<Sign>> SignExt for O {
let mut error = ptr::null_mut();
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))
}
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 commit(
&self,
repo: &Repo,
commit_checksum: &str,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> Result<(), glib::Error> {
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 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,
);
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))
}
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 commit_verify(
&self,
repo: &Repo,
commit_checksum: &str,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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> {
unsafe {
let mut out_success_message = ptr::null_mut();
let mut error = ptr::null_mut();
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,
);
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))
}
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 data(
&self,
data: &glib::Bytes,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> Result<glib::Bytes, glib::Error> {
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 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,
);
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))
}
if error.is_null() { Ok(from_glib_full(signature)) } else { Err(from_glib_full(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> {
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 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,
);
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))
}
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"))]
@ -294,17 +201,9 @@ impl<O: IsA<Sign>> SignExt for O {
fn load_pk(&self, options: &glib::Variant) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let is_ok = ffi::ostree_sign_load_pk(
self.as_ref().to_glib_none().0,
options.to_glib_none().0,
&mut 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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -312,9 +211,7 @@ impl<O: IsA<Sign>> SignExt for O {
#[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))
}
}
@ -322,9 +219,7 @@ impl<O: IsA<Sign>> SignExt for O {
#[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))
}
}
@ -333,17 +228,9 @@ impl<O: IsA<Sign>> SignExt for O {
fn set_pk(&self, public_key: &glib::Variant) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let is_ok = ffi::ostree_sign_set_pk(
self.as_ref().to_glib_none().0,
public_key.to_glib_none().0,
&mut 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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -352,43 +239,20 @@ impl<O: IsA<Sign>> SignExt for O {
fn set_sk(&self, secret_key: &glib::Variant) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let is_ok = ffi::ostree_sign_set_sk(
self.as_ref().to_glib_none().0,
secret_key.to_glib_none().0,
&mut 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))
}
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 summary(
&self,
repo: &Repo,
keys: &glib::Variant,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> Result<(), glib::Error> {
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 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,
);
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
}

View File

@ -49,35 +49,24 @@ impl Sysroot {
#[doc(alias = "ostree_sysroot_new")]
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(
&self,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> Result<(), glib::Error> {
pub fn cleanup(&self, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let is_ok = ffi::ostree_sysroot_cleanup(
self.to_glib_none().0,
cancellable.map(|p| p.as_ref()).to_glib_none().0,
&mut 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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -91,218 +80,90 @@ impl Sysroot {
#[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(
&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> {
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 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,
);
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))
}
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(
&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> {
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 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,
);
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))
}
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(
&self,
deployment: &Deployment,
new_kargs: &[&str],
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
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(
&self,
deployment: &Deployment,
kargs_str: Option<&str>,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[doc(alias = "ostree_sysroot_deployment_set_mutable")]
pub fn deployment_set_mutable(
&self,
deployment: &Deployment,
is_mutable: bool,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
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 is_ok = ffi::ostree_sysroot_deployment_set_pinned(
self.to_glib_none().0,
deployment.to_glib_none().0,
is_pinned.into_glib(),
&mut 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))
}
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(
&self,
deployment: &Deployment,
unlocked_state: DeploymentUnlockedState,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[doc(alias = "ostree_sysroot_ensure_initialized")]
pub fn ensure_initialized(
&self,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 is_ok = ffi::ostree_sysroot_ensure_initialized(
self.to_glib_none().0,
cancellable.map(|p| p.as_ref()).to_glib_none().0,
&mut 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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -310,26 +171,23 @@ 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))
}
}
@ -337,10 +195,7 @@ 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))
}
}
@ -348,33 +203,32 @@ 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"))]
@ -383,40 +237,27 @@ 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(
&self,
osname: &str,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -428,11 +269,7 @@ impl Sysroot {
let mut error = ptr::null_mut();
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -440,53 +277,31 @@ 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(
&self,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> Result<(), glib::Error> {
pub fn load(&self, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let is_ok = ffi::ostree_sysroot_load(
self.to_glib_none().0,
cancellable.map(|p| p.as_ref()).to_glib_none().0,
&mut 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))
}
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(
&self,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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();
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);
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))
}
if error.is_null() { Ok(from_glib(out_changed.assume_init())) } else { Err(from_glib_full(error)) }
}
}
@ -496,117 +311,76 @@ impl Sysroot {
let mut error = ptr::null_mut();
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[doc(alias = "ostree_sysroot_lock_async")]
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"
);
pub fn lock_async<P: FnOnce(Result<(), glib::Error>) + 'static>(&self, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P) {
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 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_<glib::thread_guard::ThreadGuard<P>> =
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::<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_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(
&self,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 is_ok = ffi::ostree_sysroot_prepare_cleanup(
self.to_glib_none().0,
cancellable.map(|p| p.as_ref()).to_glib_none().0,
&mut 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))
}
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))
}
}
@ -615,7 +389,9 @@ 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"))]
@ -624,13 +400,8 @@ 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)) }
}
}
@ -644,128 +415,51 @@ impl Sysroot {
}
#[doc(alias = "ostree_sysroot_simple_write_deployment")]
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> {
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 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,
);
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))
}
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(
&self,
fd: i32,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
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(
&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> {
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 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,
);
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))
}
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(
&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> {
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 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,
);
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))
}
if error.is_null() { Ok(from_glib_full(out_new_deployment)) } else { Err(from_glib_full(error)) }
}
}
@ -774,18 +468,9 @@ impl Sysroot {
unsafe {
let mut out_acquired = mem::MaybeUninit::uninit();
let mut error = ptr::null_mut();
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();
let is_ok = ffi::ostree_sysroot_try_lock(self.to_glib_none().0, out_acquired.as_mut_ptr(), &mut 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))
}
if error.is_null() { Ok(from_glib(out_acquired.assume_init())) } else { Err(from_glib_full(error)) }
}
}
@ -804,77 +489,34 @@ impl Sysroot {
}
#[doc(alias = "ostree_sysroot_write_deployments")]
pub fn write_deployments(
&self,
new_deployments: &[Deployment],
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
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(
&self,
new_deployments: &[Deployment],
opts: &SysrootWriteDeploymentsOpts,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[doc(alias = "ostree_sysroot_write_origin_file")]
pub fn write_origin_file(
&self,
deployment: &Deployment,
new_origin: Option<&glib::KeyFile>,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -882,9 +524,7 @@ impl Sysroot {
#[doc(alias = "get_deployment_origin_path")]
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))
}
}
@ -892,27 +532,14 @@ 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))
}
}
}

View File

@ -27,100 +27,48 @@ glib::wrapper! {
impl SysrootUpgrader {
#[doc(alias = "ostree_sysroot_upgrader_new")]
pub fn new(
sysroot: &Sysroot,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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(
sysroot: &Sysroot,
osname: Option<&str>,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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(
sysroot: &Sysroot,
osname: Option<&str>,
flags: SysrootUpgraderFlags,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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(
&self,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> Result<(), glib::Error> {
pub fn deploy(&self, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
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,
);
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))
}
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))
}
}
@ -128,9 +76,7 @@ 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))
}
}
@ -138,94 +84,39 @@ 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(
&self,
flags: RepoPullFlags,
upgrader_flags: SysrootUpgraderPullFlags,
progress: Option<&AsyncProgress>,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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();
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);
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))
}
if error.is_null() { Ok(from_glib(out_changed.assume_init())) } else { Err(from_glib_full(error)) }
}
}
#[doc(alias = "ostree_sysroot_upgrader_pull_one_dir")]
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> {
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 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();
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);
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))
}
if error.is_null() { Ok(from_glib(out_changed.assume_init())) } else { Err(from_glib_full(error)) }
}
}
#[doc(alias = "ostree_sysroot_upgrader_set_origin")]
pub fn set_origin(
&self,
origin: Option<&glib::KeyFile>,
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> 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 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,
);
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -245,18 +136,9 @@ impl SysrootUpgrader {
pub fn check_timestamps(repo: &Repo, from_rev: &str, to_rev: &str) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
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,
);
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))
}
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
}

View File

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d)
from gir-files (@ 94f67628d6ed)
Generated by gir (https://github.com/gtk-rs/gir @ e94fdc6499e4)
from gir-files (@ 0dbd87c01724)

View File

@ -10,7 +10,7 @@ pub fn checksum_file<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(
f: &P,
objtype: ObjectType,
cancellable: Option<&Q>,
) -> Result<Checksum, Box<dyn std::error::Error>> {
) -> Result<Checksum, Box<dyn std::error::Error + Send>> {
unsafe {
let mut out_csum = ptr::null_mut();
let mut error = ptr::null_mut();
@ -29,7 +29,7 @@ pub fn checksum_file<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(
pub fn checksum_file_async<
P: IsA<gio::File>,
Q: IsA<gio::Cancellable>,
R: FnOnce(Result<Checksum, Box<dyn std::error::Error>>) + Send + 'static,
R: FnOnce(Result<Checksum, Box<dyn std::error::Error + Send>>) + Send + 'static,
>(
f: &P,
objtype: ObjectType,
@ -39,7 +39,7 @@ pub fn checksum_file_async<
) {
let user_data: Box<R> = Box::new(callback);
unsafe extern "C" fn checksum_file_async_trampoline<
R: FnOnce(Result<Checksum, Box<dyn std::error::Error>>) + Send + 'static,
R: FnOnce(Result<Checksum, Box<dyn std::error::Error + Send>>) + Send + 'static,
>(
_source_object: *mut glib::gobject_ffi::GObject,
res: *mut gio::ffi::GAsyncResult,
@ -77,7 +77,7 @@ pub fn checksum_file_async_future<P: IsA<gio::File> + Clone + 'static>(
f: &P,
objtype: ObjectType,
io_priority: i32,
) -> Pin<Box<dyn Future<Output = Result<Checksum, Box<dyn std::error::Error>>> + 'static>> {
) -> Pin<Box<dyn Future<Output = Result<Checksum, Box<dyn std::error::Error + Send>>> + 'static>> {
let f = f.clone();
Box::pin(gio::GioFuture::new(&f, move |f, cancellable, send| {
checksum_file_async(f, objtype, io_priority, Some(cancellable), move |res| {
@ -93,7 +93,7 @@ pub fn checksum_file_from_input<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellabl
in_: Option<&P>,
objtype: ObjectType,
cancellable: Option<&Q>,
) -> Result<Checksum, Box<dyn std::error::Error>> {
) -> Result<Checksum, Box<dyn std::error::Error + Send>> {
unsafe {
let mut out_csum = ptr::null_mut();
let mut error = ptr::null_mut();
@ -147,7 +147,7 @@ unsafe fn checksum_file_error(
out_csum: *mut [*mut u8; 32],
error: *mut glib::ffi::GError,
ret: i32,
) -> Result<Checksum, Box<dyn std::error::Error>> {
) -> Result<Checksum, Box<dyn std::error::Error + Send>> {
if !error.is_null() {
Err(Box::<glib::Error>::new(from_glib_full(error)))
} else if ret == GFALSE {

View File

@ -50,6 +50,7 @@ pub use crate::functions::*;
mod mutable_tree;
pub use crate::mutable_tree::*;
#[cfg(any(feature = "v2019_3", feature = "dox"))]
#[allow(missing_docs)]
mod kernel_args;
#[cfg(any(feature = "v2019_3", feature = "dox"))]
pub use crate::kernel_args::*;
@ -63,6 +64,7 @@ pub use crate::repo::*;
mod repo_checkout_at_options;
#[cfg(any(feature = "v2016_8", feature = "dox"))]
pub use crate::repo_checkout_at_options::*;
#[allow(missing_docs)]
mod repo_transaction_stats;
pub use repo_transaction_stats::RepoTransactionStats;
mod se_policy;

View File

@ -1,6 +1,5 @@
use crate::ObjectType;
use crate::{object_name_deserialize, object_name_serialize, object_to_string};
use glib::translate::*;
use glib::GString;
use std::fmt::Display;
use std::fmt::Error;
@ -9,7 +8,7 @@ use std::hash::Hash;
use std::hash::Hasher;
fn hash_object_name(v: &glib::Variant) -> u32 {
unsafe { ffi::ostree_hash_object_name(v.to_glib_none().0 as glib::ffi::gconstpointer) }
unsafe { ffi::ostree_hash_object_name(v.as_ptr() as glib::ffi::gconstpointer) }
}
/// A reference to an object in an OSTree repo. It contains both a checksum and an

View File

@ -6,15 +6,15 @@ libc = "0.2"
[dependencies.gio]
package = "gio-sys"
version = "0.15"
version = "0.16"
[dependencies.glib]
package = "glib-sys"
version = "0.15"
version = "0.16"
[dependencies.gobject]
package = "gobject-sys"
version = "0.15"
version = "0.16"
[dev-dependencies]
shell-words = "1.0.0"
@ -56,7 +56,7 @@ v2019_6 = ["v2019_4"]
v2020_1 = ["v2019_6"]
v2020_2 = ["v2020_1"]
v2020_4 = ["v2020_2"]
dox = []
dox = ["glib/dox", "gobject/dox", "gio/dox"]
v2020_7 = ["v2020_4"]
v2020_8 = ["v2020_7"]
v2021_1 = ["v2020_8"]

View File

@ -11,7 +11,7 @@ fn main() {} // prevent linking libraries to avoid documentation failure
#[cfg(not(feature = "dox"))]
fn main() {
if let Err(s) = system_deps::Config::new().probe() {
println!("cargo:warning={}", s);
println!("cargo:warning={s}");
process::exit(1);
}
}

View File

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d)
from gir-files (@ 94f67628d6ed)
Generated by gir (https://github.com/gtk-rs/gir @ e94fdc6499e4)
from gir-files (@ 0dbd87c01724)

View File

@ -302,7 +302,7 @@ pub struct OstreeAsyncProgressClass {
impl ::std::fmt::Debug for OstreeAsyncProgressClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeAsyncProgressClass @ {:p}", self))
f.debug_struct(&format!("OstreeAsyncProgressClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.field("changed", &self.changed)
.finish()
@ -366,7 +366,7 @@ pub struct OstreeCollectionRef {
impl ::std::fmt::Debug for OstreeCollectionRef {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeCollectionRef @ {:p}", self))
f.debug_struct(&format!("OstreeCollectionRef @ {self:p}"))
.field("collection_id", &self.collection_id)
.field("ref_name", &self.ref_name)
.finish()
@ -384,7 +384,7 @@ pub struct OstreeCommitSizesEntry {
impl ::std::fmt::Debug for OstreeCommitSizesEntry {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeCommitSizesEntry @ {:p}", self))
f.debug_struct(&format!("OstreeCommitSizesEntry @ {self:p}"))
.field("checksum", &self.checksum)
.field("objtype", &self.objtype)
.field("unpacked", &self.unpacked)
@ -401,7 +401,7 @@ pub struct OstreeContentWriterClass {
impl ::std::fmt::Debug for OstreeContentWriterClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeContentWriterClass @ {:p}", self))
f.debug_struct(&format!("OstreeContentWriterClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@ -420,7 +420,7 @@ pub struct OstreeDiffDirsOptions {
impl ::std::fmt::Debug for OstreeDiffDirsOptions {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeDiffDirsOptions @ {:p}", self))
f.debug_struct(&format!("OstreeDiffDirsOptions @ {self:p}"))
.field("owner_uid", &self.owner_uid)
.field("owner_gid", &self.owner_gid)
.field("devino_to_csum_cache", &self.devino_to_csum_cache)
@ -445,7 +445,7 @@ pub struct OstreeDiffItem {
impl ::std::fmt::Debug for OstreeDiffItem {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeDiffItem @ {:p}", self))
f.debug_struct(&format!("OstreeDiffItem @ {self:p}"))
.field("refcount", &self.refcount)
.field("src", &self.src)
.field("target", &self.target)
@ -513,7 +513,7 @@ pub struct OstreeMutableTreeClass {
impl ::std::fmt::Debug for OstreeMutableTreeClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeMutableTreeClass @ {:p}", self))
f.debug_struct(&format!("OstreeMutableTreeClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@ -528,7 +528,7 @@ pub struct OstreeMutableTreeIter {
impl ::std::fmt::Debug for OstreeMutableTreeIter {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeMutableTreeIter @ {:p}", self))
f.debug_struct(&format!("OstreeMutableTreeIter @ {self:p}"))
.field("in_files", &self.in_files)
.field("iter", &self.iter)
.finish()
@ -543,8 +543,7 @@ pub struct OstreeRemote {
impl ::std::fmt::Debug for OstreeRemote {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRemote @ {:p}", self))
.finish()
f.debug_struct(&format!("OstreeRemote @ {self:p}")).finish()
}
}
@ -574,7 +573,7 @@ pub struct OstreeRepoCheckoutAtOptions {
impl ::std::fmt::Debug for OstreeRepoCheckoutAtOptions {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoCheckoutAtOptions @ {:p}", self))
f.debug_struct(&format!("OstreeRepoCheckoutAtOptions @ {self:p}"))
.field("mode", &self.mode)
.field("overwrite_mode", &self.overwrite_mode)
.field("enable_uncompressed_cache", &self.enable_uncompressed_cache)
@ -612,7 +611,7 @@ pub struct OstreeRepoCheckoutOptions {
impl ::std::fmt::Debug for OstreeRepoCheckoutOptions {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoCheckoutOptions @ {:p}", self))
f.debug_struct(&format!("OstreeRepoCheckoutOptions @ {self:p}"))
.field("mode", &self.mode)
.field("overwrite_mode", &self.overwrite_mode)
.field("enable_uncompressed_cache", &self.enable_uncompressed_cache)
@ -628,7 +627,7 @@ pub struct OstreeRepoCommitModifier {
impl ::std::fmt::Debug for OstreeRepoCommitModifier {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoCommitModifier @ {:p}", self))
f.debug_struct(&format!("OstreeRepoCommitModifier @ {self:p}"))
.finish()
}
}
@ -643,7 +642,7 @@ pub struct OstreeRepoCommitTraverseIter {
impl ::std::fmt::Debug for OstreeRepoCommitTraverseIter {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoCommitTraverseIter @ {:p}", self))
f.debug_struct(&format!("OstreeRepoCommitTraverseIter @ {self:p}"))
.field("initialized", &self.initialized)
.field("dummy", &self.dummy)
.finish()
@ -658,7 +657,7 @@ pub struct OstreeRepoDevInoCache {
impl ::std::fmt::Debug for OstreeRepoDevInoCache {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoDevInoCache @ {:p}", self))
f.debug_struct(&format!("OstreeRepoDevInoCache @ {self:p}"))
.finish()
}
}
@ -672,7 +671,7 @@ pub struct OstreeRepoExportArchiveOptions {
impl ::std::fmt::Debug for OstreeRepoExportArchiveOptions {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoExportArchiveOptions @ {:p}", self))
f.debug_struct(&format!("OstreeRepoExportArchiveOptions @ {self:p}"))
.field("disable_xattrs", &self.disable_xattrs)
.finish()
}
@ -686,7 +685,7 @@ pub struct OstreeRepoFileClass {
impl ::std::fmt::Debug for OstreeRepoFileClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFileClass @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFileClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@ -708,7 +707,7 @@ pub struct OstreeRepoFinderAvahiClass {
impl ::std::fmt::Debug for OstreeRepoFinderAvahiClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderAvahiClass @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderAvahiClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@ -722,7 +721,7 @@ pub struct OstreeRepoFinderConfigClass {
impl ::std::fmt::Debug for OstreeRepoFinderConfigClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderConfigClass @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderConfigClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@ -753,7 +752,7 @@ pub struct OstreeRepoFinderInterface {
impl ::std::fmt::Debug for OstreeRepoFinderInterface {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderInterface @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderInterface @ {self:p}"))
.field("g_iface", &self.g_iface)
.field("resolve_async", &self.resolve_async)
.field("resolve_finish", &self.resolve_finish)
@ -769,7 +768,7 @@ pub struct OstreeRepoFinderMountClass {
impl ::std::fmt::Debug for OstreeRepoFinderMountClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderMountClass @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderMountClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@ -783,7 +782,7 @@ pub struct OstreeRepoFinderOverrideClass {
impl ::std::fmt::Debug for OstreeRepoFinderOverrideClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderOverrideClass @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderOverrideClass @ {self:p}"))
.field("parent_class", &self.parent_class)
.finish()
}
@ -803,7 +802,7 @@ pub struct OstreeRepoFinderResult {
impl ::std::fmt::Debug for OstreeRepoFinderResult {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderResult @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderResult @ {self:p}"))
.field("remote", &self.remote)
.field("finder", &self.finder)
.field("priority", &self.priority)
@ -823,7 +822,7 @@ pub struct OstreeRepoImportArchiveOptions {
impl ::std::fmt::Debug for OstreeRepoImportArchiveOptions {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoImportArchiveOptions @ {:p}", self))
f.debug_struct(&format!("OstreeRepoImportArchiveOptions @ {self:p}"))
.field(
"ignore_unsupported_content",
&self.ignore_unsupported_content,
@ -844,7 +843,7 @@ pub struct OstreeRepoPruneOptions {
impl ::std::fmt::Debug for OstreeRepoPruneOptions {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoPruneOptions @ {:p}", self))
f.debug_struct(&format!("OstreeRepoPruneOptions @ {self:p}"))
.field("flags", &self.flags)
.field("reachable", &self.reachable)
.field("unused_bools", &self.unused_bools)
@ -871,7 +870,7 @@ pub struct OstreeRepoTransactionStats {
impl ::std::fmt::Debug for OstreeRepoTransactionStats {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoTransactionStats @ {:p}", self))
f.debug_struct(&format!("OstreeRepoTransactionStats @ {self:p}"))
.field("metadata_objects_total", &self.metadata_objects_total)
.field("metadata_objects_written", &self.metadata_objects_written)
.field("content_objects_total", &self.content_objects_total)
@ -945,7 +944,7 @@ pub struct OstreeSignInterface {
impl ::std::fmt::Debug for OstreeSignInterface {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeSignInterface @ {:p}", self))
f.debug_struct(&format!("OstreeSignInterface @ {self:p}"))
.field("g_iface", &self.g_iface)
.field("get_name", &self.get_name)
.field("data", &self.data)
@ -973,7 +972,7 @@ pub struct OstreeSysrootDeployTreeOpts {
impl ::std::fmt::Debug for OstreeSysrootDeployTreeOpts {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeSysrootDeployTreeOpts @ {:p}", self))
f.debug_struct(&format!("OstreeSysrootDeployTreeOpts @ {self:p}"))
.field("unused_bools", &self.unused_bools)
.field("unused_ints", &self.unused_ints)
.field("override_kernel_argv", &self.override_kernel_argv)
@ -994,7 +993,7 @@ pub struct OstreeSysrootWriteDeploymentsOpts {
impl ::std::fmt::Debug for OstreeSysrootWriteDeploymentsOpts {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeSysrootWriteDeploymentsOpts @ {:p}", self))
f.debug_struct(&format!("OstreeSysrootWriteDeploymentsOpts @ {self:p}"))
.field("do_postclean", &self.do_postclean)
.field("unused_bools", &self.unused_bools)
.field("unused_ints", &self.unused_ints)
@ -1012,7 +1011,7 @@ pub struct OstreeAsyncProgress {
impl ::std::fmt::Debug for OstreeAsyncProgress {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeAsyncProgress @ {:p}", self))
f.debug_struct(&format!("OstreeAsyncProgress @ {self:p}"))
.finish()
}
}
@ -1025,7 +1024,7 @@ pub struct OstreeBootconfigParser {
impl ::std::fmt::Debug for OstreeBootconfigParser {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeBootconfigParser @ {:p}", self))
f.debug_struct(&format!("OstreeBootconfigParser @ {self:p}"))
.finish()
}
}
@ -1038,7 +1037,7 @@ pub struct OstreeContentWriter {
impl ::std::fmt::Debug for OstreeContentWriter {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeContentWriter @ {:p}", self))
f.debug_struct(&format!("OstreeContentWriter @ {self:p}"))
.finish()
}
}
@ -1051,7 +1050,7 @@ pub struct OstreeDeployment {
impl ::std::fmt::Debug for OstreeDeployment {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeDeployment @ {:p}", self))
f.debug_struct(&format!("OstreeDeployment @ {self:p}"))
.finish()
}
}
@ -1064,7 +1063,7 @@ pub struct OstreeGpgVerifyResult {
impl ::std::fmt::Debug for OstreeGpgVerifyResult {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeGpgVerifyResult @ {:p}", self))
f.debug_struct(&format!("OstreeGpgVerifyResult @ {self:p}"))
.finish()
}
}
@ -1077,7 +1076,7 @@ pub struct OstreeMutableTree {
impl ::std::fmt::Debug for OstreeMutableTree {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeMutableTree @ {:p}", self))
f.debug_struct(&format!("OstreeMutableTree @ {self:p}"))
.finish()
}
}
@ -1090,7 +1089,7 @@ pub struct OstreeRepo {
impl ::std::fmt::Debug for OstreeRepo {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepo @ {:p}", self)).finish()
f.debug_struct(&format!("OstreeRepo @ {self:p}")).finish()
}
}
@ -1102,7 +1101,7 @@ pub struct OstreeRepoFile {
impl ::std::fmt::Debug for OstreeRepoFile {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFile @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFile @ {self:p}"))
.finish()
}
}
@ -1115,7 +1114,7 @@ pub struct OstreeRepoFinderAvahi {
impl ::std::fmt::Debug for OstreeRepoFinderAvahi {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderAvahi @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderAvahi @ {self:p}"))
.finish()
}
}
@ -1128,7 +1127,7 @@ pub struct OstreeRepoFinderConfig {
impl ::std::fmt::Debug for OstreeRepoFinderConfig {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderConfig @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderConfig @ {self:p}"))
.finish()
}
}
@ -1141,7 +1140,7 @@ pub struct OstreeRepoFinderMount {
impl ::std::fmt::Debug for OstreeRepoFinderMount {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderMount @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderMount @ {self:p}"))
.finish()
}
}
@ -1154,7 +1153,7 @@ pub struct OstreeRepoFinderOverride {
impl ::std::fmt::Debug for OstreeRepoFinderOverride {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeRepoFinderOverride @ {:p}", self))
f.debug_struct(&format!("OstreeRepoFinderOverride @ {self:p}"))
.finish()
}
}
@ -1167,7 +1166,7 @@ pub struct OstreeSePolicy {
impl ::std::fmt::Debug for OstreeSePolicy {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeSePolicy @ {:p}", self))
f.debug_struct(&format!("OstreeSePolicy @ {self:p}"))
.finish()
}
}
@ -1180,7 +1179,7 @@ pub struct OstreeSysroot {
impl ::std::fmt::Debug for OstreeSysroot {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeSysroot @ {:p}", self))
f.debug_struct(&format!("OstreeSysroot @ {self:p}"))
.finish()
}
}
@ -1193,7 +1192,7 @@ pub struct OstreeSysrootUpgrader {
impl ::std::fmt::Debug for OstreeSysrootUpgrader {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("OstreeSysrootUpgrader @ {:p}", self))
f.debug_struct(&format!("OstreeSysrootUpgrader @ {self:p}"))
.finish()
}
}
@ -1207,7 +1206,7 @@ pub struct OstreeRepoFinder {
impl ::std::fmt::Debug for OstreeRepoFinder {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
write!(f, "OstreeRepoFinder @ {:p}", self)
write!(f, "OstreeRepoFinder @ {self:p}")
}
}
@ -1219,7 +1218,7 @@ pub struct OstreeSign {
impl ::std::fmt::Debug for OstreeSign {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
write!(f, "OstreeSign @ {:p}", self)
write!(f, "OstreeSign @ {self:p}")
}
}

View File

@ -40,7 +40,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
return Err(format!("compilation command {cmd:?} failed, {status}").into());
}
Ok(())
}
@ -56,7 +56,7 @@ fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<dyn Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
Err(err) => Err(format!("{name} {err}").into()),
}
}
@ -70,7 +70,7 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
return Err(format!("command {cmd:?} returned {}", out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
@ -115,13 +115,8 @@ fn cross_validate_constants_with_c() {
let mut c_constants: Vec<(String, String)> = Vec::new();
for l in get_c_output("constant").unwrap().lines() {
let mut words = l.trim().split(';');
let name = words.next().expect("Failed to parse name").to_owned();
let value = words
.next()
.and_then(|s| s.parse().ok())
.expect("Failed to parse value");
c_constants.push((name, value));
let (name, value) = l.split_once(';').expect("Missing ';' separator");
c_constants.push((name.to_owned(), value.to_owned()));
}
let mut results = Results::default();
@ -131,15 +126,14 @@ fn cross_validate_constants_with_c() {
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
"Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}",
);
continue;
}
@ -156,17 +150,11 @@ fn cross_validate_layout_with_c() {
let mut c_layouts = Vec::new();
for l in get_c_output("layout").unwrap().lines() {
let mut words = l.trim().split(';');
let name = words.next().expect("Failed to parse name").to_owned();
let size = words
.next()
.and_then(|s| s.parse().ok())
.expect("Failed to parse size");
let alignment = words
.next()
.and_then(|s| s.parse().ok())
.expect("Failed to parse alignment");
c_layouts.push((name, Layout { size, alignment }));
let (name, value) = l.split_once(';').expect("Missing first ';' separator");
let (size, alignment) = value.split_once(';').expect("Missing second ';' separator");
let size = size.parse().expect("Failed to parse size");
let alignment = alignment.parse().expect("Failed to parse alignment");
c_layouts.push((name.to_owned(), Layout { size, alignment }));
}
let mut results = Results::default();
@ -175,16 +163,13 @@ fn cross_validate_layout_with_c() {
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}");
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",);
continue;
}
@ -205,7 +190,7 @@ fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
return Err(format!("command {abi_cmd:?} failed, {output:?}").into());
}
Ok(String::from_utf8(output.stdout)?)