Regenerate and update to new gir and glib-rs version

This commit is contained in:
Felix Krull 2019-05-21 00:08:26 +02:00 committed by Colin Walters
parent df2d708f30
commit 61e205b5c3
28 changed files with 1985 additions and 2618 deletions

View File

@ -31,12 +31,12 @@ name = "ostree"
libc = "0.2"
bitflags = "1"
lazy_static = "1.1"
glib = "0.6"
gio = "0.5"
glib-sys = "0.7"
gobject-sys = "0.7"
gio-sys = "0.7"
ostree-sys = { version = "0.3", path = "sys" }
glib = "0.7.1"
gio = "0.6.0"
glib-sys = "0.8.0"
gobject-sys = "0.8.0"
gio-sys = "0.8.0"
ostree-sys = { version = "0.3.0", path = "sys" }
[dev-dependencies]
tempfile = "3"

View File

@ -61,6 +61,9 @@ manual = [
"GLib.Variant",
]
[crate_name_overrides]
os_tree = "ostree"
[[object]]
name = "OSTree.CollectionRef"
status = "manual"

View File

@ -2,37 +2,38 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use ffi;
#[cfg(any(feature = "v2017_6", feature = "dox"))]
use glib;
use glib::object::Downcast;
#[cfg(any(feature = "v2017_6", feature = "dox"))]
use glib::GString;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::signal::connect_raw;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use glib_sys;
use ostree_sys;
use std::boxed::Box as Box_;
use std::mem;
use std::fmt;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct AsyncProgress(Object<ffi::OstreeAsyncProgress, ffi::OstreeAsyncProgressClass>);
pub struct AsyncProgress(Object<ostree_sys::OstreeAsyncProgress, ostree_sys::OstreeAsyncProgressClass, AsyncProgressClass>);
match fn {
get_type => || ffi::ostree_async_progress_get_type(),
get_type => || ostree_sys::ostree_async_progress_get_type(),
}
}
impl AsyncProgress {
pub fn new() -> AsyncProgress {
unsafe {
from_glib_full(ffi::ostree_async_progress_new())
from_glib_full(ostree_sys::ostree_async_progress_new())
}
}
//pub fn new_and_connect<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(changed: P, user_data: Q) -> AsyncProgress {
// unsafe { TODO: call ffi::ostree_async_progress_new_and_connect() }
//pub fn new_and_connect(changed: /*Unimplemented*/Option<Fundamental: Pointer>, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> AsyncProgress {
// unsafe { TODO: call ostree_sys:ostree_async_progress_new_and_connect() }
//}
}
@ -42,14 +43,16 @@ impl Default for AsyncProgress {
}
}
pub trait AsyncProgressExt {
pub const NONE_ASYNC_PROGRESS: Option<&AsyncProgress> = None;
pub trait AsyncProgressExt: 'static {
fn finish(&self);
//#[cfg(any(feature = "v2017_6", feature = "dox"))]
//fn get(&self, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
#[cfg(any(feature = "v2017_6", feature = "dox"))]
fn get_status(&self) -> Option<String>;
fn get_status(&self) -> Option<GString>;
fn get_uint(&self, key: &str) -> u32;
@ -62,7 +65,7 @@ pub trait AsyncProgressExt {
//fn set(&self, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
#[cfg(any(feature = "v2017_6", feature = "dox"))]
fn set_status<'a, P: Into<Option<&'a str>>>(&self, status: P);
fn set_status(&self, status: Option<&str>);
fn set_uint(&self, key: &str, value: u32);
@ -74,88 +77,92 @@ pub trait AsyncProgressExt {
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<AsyncProgress> + IsA<glib::object::Object>> AsyncProgressExt for O {
impl<O: IsA<AsyncProgress>> AsyncProgressExt for O {
fn finish(&self) {
unsafe {
ffi::ostree_async_progress_finish(self.to_glib_none().0);
ostree_sys::ostree_async_progress_finish(self.as_ref().to_glib_none().0);
}
}
//#[cfg(any(feature = "v2017_6", feature = "dox"))]
//fn get(&self, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
// unsafe { TODO: call ffi::ostree_async_progress_get() }
// unsafe { TODO: call ostree_sys:ostree_async_progress_get() }
//}
#[cfg(any(feature = "v2017_6", feature = "dox"))]
fn get_status(&self) -> Option<String> {
fn get_status(&self) -> Option<GString> {
unsafe {
from_glib_full(ffi::ostree_async_progress_get_status(self.to_glib_none().0))
from_glib_full(ostree_sys::ostree_async_progress_get_status(self.as_ref().to_glib_none().0))
}
}
fn get_uint(&self, key: &str) -> u32 {
unsafe {
ffi::ostree_async_progress_get_uint(self.to_glib_none().0, key.to_glib_none().0)
ostree_sys::ostree_async_progress_get_uint(self.as_ref().to_glib_none().0, key.to_glib_none().0)
}
}
fn get_uint64(&self, key: &str) -> u64 {
unsafe {
ffi::ostree_async_progress_get_uint64(self.to_glib_none().0, key.to_glib_none().0)
ostree_sys::ostree_async_progress_get_uint64(self.as_ref().to_glib_none().0, key.to_glib_none().0)
}
}
#[cfg(any(feature = "v2017_6", feature = "dox"))]
fn get_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(ostree_sys::ostree_async_progress_get_variant(self.as_ref().to_glib_none().0, key.to_glib_none().0))
}
}
//#[cfg(any(feature = "v2017_6", feature = "dox"))]
//fn set(&self, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
// unsafe { TODO: call ffi::ostree_async_progress_set() }
// unsafe { TODO: call ostree_sys:ostree_async_progress_set() }
//}
#[cfg(any(feature = "v2017_6", feature = "dox"))]
fn set_status<'a, P: Into<Option<&'a str>>>(&self, status: P) {
let status = status.into();
let status = status.to_glib_none();
fn set_status(&self, status: Option<&str>) {
unsafe {
ffi::ostree_async_progress_set_status(self.to_glib_none().0, status.0);
ostree_sys::ostree_async_progress_set_status(self.as_ref().to_glib_none().0, status.to_glib_none().0);
}
}
fn set_uint(&self, key: &str, value: u32) {
unsafe {
ffi::ostree_async_progress_set_uint(self.to_glib_none().0, key.to_glib_none().0, value);
ostree_sys::ostree_async_progress_set_uint(self.as_ref().to_glib_none().0, key.to_glib_none().0, value);
}
}
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);
ostree_sys::ostree_async_progress_set_uint64(self.as_ref().to_glib_none().0, key.to_glib_none().0, value);
}
}
#[cfg(any(feature = "v2017_6", feature = "dox"))]
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);
ostree_sys::ostree_async_progress_set_variant(self.as_ref().to_glib_none().0, key.to_glib_none().0, value.to_glib_none().0);
}
}
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "changed",
transmute(changed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"changed\0".as_ptr() as *const _,
Some(transmute(changed_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
}
unsafe extern "C" fn changed_trampoline<P>(this: *mut ffi::OstreeAsyncProgress, f: glib_ffi::gpointer)
unsafe extern "C" fn changed_trampoline<P, F: Fn(&P) + 'static>(this: *mut ostree_sys::OstreeAsyncProgress, f: glib_sys::gpointer)
where P: IsA<AsyncProgress> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&AsyncProgress::from_glib_borrow(this).downcast_unchecked())
let f: &F = &*(f as *const F);
f(&AsyncProgress::from_glib_borrow(this).unsafe_cast())
}
impl fmt::Display for AsyncProgress {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "AsyncProgress")
}
}

View File

@ -3,27 +3,76 @@
// DO NOT EDIT
use Error;
use ffi;
use gio;
use glib::GString;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use ostree_sys;
use std::fmt;
use std::ptr;
glib_wrapper! {
pub struct BootconfigParser(Object<ffi::OstreeBootconfigParser>);
pub struct BootconfigParser(Object<ostree_sys::OstreeBootconfigParser, BootconfigParserClass>);
match fn {
get_type => || ffi::ostree_bootconfig_parser_get_type(),
get_type => || ostree_sys::ostree_bootconfig_parser_get_type(),
}
}
impl BootconfigParser {
pub fn new() -> BootconfigParser {
unsafe {
from_glib_full(ffi::ostree_bootconfig_parser_new())
from_glib_full(ostree_sys::ostree_bootconfig_parser_new())
}
}
pub fn clone(&self) -> Option<BootconfigParser> {
unsafe {
from_glib_full(ostree_sys::ostree_bootconfig_parser_clone(self.to_glib_none().0))
}
}
pub fn get(&self, key: &str) -> Option<GString> {
unsafe {
from_glib_none(ostree_sys::ostree_bootconfig_parser_get(self.to_glib_none().0, key.to_glib_none().0))
}
}
pub fn parse<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(&self, path: &P, cancellable: Option<&Q>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ostree_sys::ostree_bootconfig_parser_parse(self.to_glib_none().0, path.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
pub fn parse_at<P: IsA<gio::Cancellable>>(&self, dfd: i32, path: &str, cancellable: Option<&P>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ostree_sys::ostree_bootconfig_parser_parse_at(self.to_glib_none().0, dfd, path.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
pub fn set(&self, key: &str, value: &str) {
unsafe {
ostree_sys::ostree_bootconfig_parser_set(self.to_glib_none().0, key.to_glib_none().0, value.to_glib_none().0);
}
}
pub fn write<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(&self, output: &P, cancellable: Option<&Q>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ostree_sys::ostree_bootconfig_parser_write(self.to_glib_none().0, output.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
pub fn write_at<P: IsA<gio::Cancellable>>(&self, dfd: i32, path: &str, cancellable: Option<&P>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ostree_sys::ostree_bootconfig_parser_write_at(self.to_glib_none().0, dfd, path.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
}
@ -34,78 +83,8 @@ impl Default for BootconfigParser {
}
}
pub trait BootconfigParserExt {
fn clone(&self) -> Option<BootconfigParser>;
fn get(&self, key: &str) -> Option<String>;
fn parse<'a, P: IsA<gio::File>, Q: Into<Option<&'a gio::Cancellable>>>(&self, path: &P, cancellable: Q) -> Result<(), Error>;
fn parse_at<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, dfd: i32, path: &str, cancellable: P) -> Result<(), Error>;
fn set(&self, key: &str, value: &str);
fn write<'a, P: IsA<gio::File>, Q: Into<Option<&'a gio::Cancellable>>>(&self, output: &P, cancellable: Q) -> Result<(), Error>;
fn write_at<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, dfd: i32, path: &str, cancellable: P) -> Result<(), Error>;
}
impl<O: IsA<BootconfigParser>> BootconfigParserExt for O {
fn clone(&self) -> Option<BootconfigParser> {
unsafe {
from_glib_full(ffi::ostree_bootconfig_parser_clone(self.to_glib_none().0))
}
}
fn get(&self, key: &str) -> Option<String> {
unsafe {
from_glib_none(ffi::ostree_bootconfig_parser_get(self.to_glib_none().0, key.to_glib_none().0))
}
}
fn parse<'a, P: IsA<gio::File>, Q: Into<Option<&'a gio::Cancellable>>>(&self, path: &P, cancellable: Q) -> Result<(), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_bootconfig_parser_parse(self.to_glib_none().0, path.to_glib_none().0, cancellable.0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
fn parse_at<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, dfd: i32, path: &str, cancellable: P) -> Result<(), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_bootconfig_parser_parse_at(self.to_glib_none().0, dfd, path.to_glib_none().0, cancellable.0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
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);
}
}
fn write<'a, P: IsA<gio::File>, Q: Into<Option<&'a gio::Cancellable>>>(&self, output: &P, cancellable: Q) -> Result<(), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_bootconfig_parser_write(self.to_glib_none().0, output.to_glib_none().0, cancellable.0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
fn write_at<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, dfd: i32, path: &str, cancellable: P) -> Result<(), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_bootconfig_parser_write_at(self.to_glib_none().0, dfd, path.to_glib_none().0, cancellable.0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
impl fmt::Display for BootconfigParser {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "BootconfigParser")
}
}

View File

@ -2,60 +2,60 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use ffi;
use ostree_sys;
use std::ffi::CStr;
lazy_static! {
pub static ref COMMIT_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_GVARIANT_STRING).to_str().unwrap()};
pub static ref COMMIT_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ostree_sys::OSTREE_COMMIT_GVARIANT_STRING).to_str().unwrap()};
}
#[cfg(any(feature = "v2018_6", feature = "dox"))]
lazy_static! {
pub static ref COMMIT_META_KEY_COLLECTION_BINDING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_COLLECTION_BINDING).to_str().unwrap()};
pub static ref COMMIT_META_KEY_COLLECTION_BINDING: &'static str = unsafe{CStr::from_ptr(ostree_sys::OSTREE_COMMIT_META_KEY_COLLECTION_BINDING).to_str().unwrap()};
}
#[cfg(any(feature = "v2017_7", feature = "dox"))]
lazy_static! {
pub static ref COMMIT_META_KEY_ENDOFLIFE: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ENDOFLIFE).to_str().unwrap()};
pub static ref COMMIT_META_KEY_ENDOFLIFE: &'static str = unsafe{CStr::from_ptr(ostree_sys::OSTREE_COMMIT_META_KEY_ENDOFLIFE).to_str().unwrap()};
}
#[cfg(any(feature = "v2017_7", feature = "dox"))]
lazy_static! {
pub static ref COMMIT_META_KEY_ENDOFLIFE_REBASE: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ENDOFLIFE_REBASE).to_str().unwrap()};
pub static ref COMMIT_META_KEY_ENDOFLIFE_REBASE: &'static str = unsafe{CStr::from_ptr(ostree_sys::OSTREE_COMMIT_META_KEY_ENDOFLIFE_REBASE).to_str().unwrap()};
}
#[cfg(any(feature = "v2017_9", feature = "dox"))]
lazy_static! {
pub static ref COMMIT_META_KEY_REF_BINDING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_REF_BINDING).to_str().unwrap()};
pub static ref COMMIT_META_KEY_REF_BINDING: &'static str = unsafe{CStr::from_ptr(ostree_sys::OSTREE_COMMIT_META_KEY_REF_BINDING).to_str().unwrap()};
}
#[cfg(any(feature = "v2017_13", feature = "dox"))]
lazy_static! {
pub static ref COMMIT_META_KEY_SOURCE_TITLE: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_SOURCE_TITLE).to_str().unwrap()};
pub static ref COMMIT_META_KEY_SOURCE_TITLE: &'static str = unsafe{CStr::from_ptr(ostree_sys::OSTREE_COMMIT_META_KEY_SOURCE_TITLE).to_str().unwrap()};
}
#[cfg(any(feature = "v2014_9", feature = "dox"))]
lazy_static! {
pub static ref COMMIT_META_KEY_VERSION: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_VERSION).to_str().unwrap()};
pub static ref COMMIT_META_KEY_VERSION: &'static str = unsafe{CStr::from_ptr(ostree_sys::OSTREE_COMMIT_META_KEY_VERSION).to_str().unwrap()};
}
lazy_static! {
pub static ref DIRMETA_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_DIRMETA_GVARIANT_STRING).to_str().unwrap()};
pub static ref DIRMETA_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ostree_sys::OSTREE_DIRMETA_GVARIANT_STRING).to_str().unwrap()};
}
lazy_static! {
pub static ref FILEMETA_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_FILEMETA_GVARIANT_STRING).to_str().unwrap()};
pub static ref FILEMETA_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ostree_sys::OSTREE_FILEMETA_GVARIANT_STRING).to_str().unwrap()};
}
#[cfg(any(feature = "v2018_9", feature = "dox"))]
lazy_static! {
pub static ref META_KEY_DEPLOY_COLLECTION_ID: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_META_KEY_DEPLOY_COLLECTION_ID).to_str().unwrap()};
pub static ref META_KEY_DEPLOY_COLLECTION_ID: &'static str = unsafe{CStr::from_ptr(ostree_sys::OSTREE_META_KEY_DEPLOY_COLLECTION_ID).to_str().unwrap()};
}
#[cfg(any(feature = "v2018_3", feature = "dox"))]
lazy_static! {
pub static ref ORIGIN_TRANSIENT_GROUP: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_ORIGIN_TRANSIENT_GROUP).to_str().unwrap()};
pub static ref ORIGIN_TRANSIENT_GROUP: &'static str = unsafe{CStr::from_ptr(ostree_sys::OSTREE_ORIGIN_TRANSIENT_GROUP).to_str().unwrap()};
}
#[cfg(any(feature = "v2018_6", feature = "dox"))]
lazy_static! {
pub static ref REPO_METADATA_REF: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_REPO_METADATA_REF).to_str().unwrap()};
pub static ref REPO_METADATA_REF: &'static str = unsafe{CStr::from_ptr(ostree_sys::OSTREE_REPO_METADATA_REF).to_str().unwrap()};
}
lazy_static! {
pub static ref SUMMARY_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_SUMMARY_GVARIANT_STRING).to_str().unwrap()};
pub static ref SUMMARY_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ostree_sys::OSTREE_SUMMARY_GVARIANT_STRING).to_str().unwrap()};
}
lazy_static! {
pub static ref SUMMARY_SIG_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_SUMMARY_SIG_GVARIANT_STRING).to_str().unwrap()};
pub static ref SUMMARY_SIG_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ostree_sys::OSTREE_SUMMARY_SIG_GVARIANT_STRING).to_str().unwrap()};
}
lazy_static! {
pub static ref TREE_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_TREE_GVARIANT_STRING).to_str().unwrap()};
pub static ref TREE_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ostree_sys::OSTREE_TREE_GVARIANT_STRING).to_str().unwrap()};
}

View File

@ -5,201 +5,162 @@
use BootconfigParser;
#[cfg(any(feature = "v2016_4", feature = "dox"))]
use DeploymentUnlockedState;
use ffi;
use glib;
use glib::object::IsA;
use glib::GString;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
use glib_sys;
use ostree_sys;
use std::fmt;
glib_wrapper! {
pub struct Deployment(Object<ffi::OstreeDeployment>);
pub struct Deployment(Object<ostree_sys::OstreeDeployment, DeploymentClass>);
match fn {
get_type => || ffi::ostree_deployment_get_type(),
get_type => || ostree_sys::ostree_deployment_get_type(),
}
}
impl Deployment {
pub fn new(index: i32, osname: &str, csum: &str, deployserial: i32, bootcsum: &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(ostree_sys::ostree_deployment_new(index, osname.to_glib_none().0, csum.to_glib_none().0, deployserial, bootcsum.to_glib_none().0, bootserial))
}
}
pub fn clone(&self) -> Option<Deployment> {
unsafe {
from_glib_full(ostree_sys::ostree_deployment_clone(self.to_glib_none().0))
}
}
pub fn equal(&self, bp: &Deployment) -> bool {
unsafe {
from_glib(ostree_sys::ostree_deployment_equal(ToGlibPtr::<*mut ostree_sys::OstreeDeployment>::to_glib_none(self).0 as glib_sys::gconstpointer, ToGlibPtr::<*mut ostree_sys::OstreeDeployment>::to_glib_none(bp).0 as glib_sys::gconstpointer))
}
}
pub fn get_bootconfig(&self) -> Option<BootconfigParser> {
unsafe {
from_glib_none(ostree_sys::ostree_deployment_get_bootconfig(self.to_glib_none().0))
}
}
pub fn get_bootcsum(&self) -> Option<GString> {
unsafe {
from_glib_none(ostree_sys::ostree_deployment_get_bootcsum(self.to_glib_none().0))
}
}
pub fn get_bootserial(&self) -> i32 {
unsafe {
ostree_sys::ostree_deployment_get_bootserial(self.to_glib_none().0)
}
}
pub fn get_csum(&self) -> Option<GString> {
unsafe {
from_glib_none(ostree_sys::ostree_deployment_get_csum(self.to_glib_none().0))
}
}
pub fn get_deployserial(&self) -> i32 {
unsafe {
ostree_sys::ostree_deployment_get_deployserial(self.to_glib_none().0)
}
}
pub fn get_index(&self) -> i32 {
unsafe {
ostree_sys::ostree_deployment_get_index(self.to_glib_none().0)
}
}
pub fn get_origin(&self) -> Option<glib::KeyFile> {
unsafe {
from_glib_none(ostree_sys::ostree_deployment_get_origin(self.to_glib_none().0))
}
}
pub fn get_origin_relpath(&self) -> Option<GString> {
unsafe {
from_glib_full(ostree_sys::ostree_deployment_get_origin_relpath(self.to_glib_none().0))
}
}
pub fn get_osname(&self) -> Option<GString> {
unsafe {
from_glib_none(ostree_sys::ostree_deployment_get_osname(self.to_glib_none().0))
}
}
#[cfg(any(feature = "v2016_4", feature = "dox"))]
pub fn get_unlocked(&self) -> DeploymentUnlockedState {
unsafe {
from_glib(ostree_sys::ostree_deployment_get_unlocked(self.to_glib_none().0))
}
}
#[cfg(any(feature = "v2018_3", feature = "dox"))]
pub fn is_pinned(&self) -> bool {
unsafe {
from_glib(ostree_sys::ostree_deployment_is_pinned(self.to_glib_none().0))
}
}
#[cfg(any(feature = "v2018_3", feature = "dox"))]
pub fn is_staged(&self) -> bool {
unsafe {
from_glib(ostree_sys::ostree_deployment_is_staged(self.to_glib_none().0))
}
}
pub fn set_bootconfig(&self, bootconfig: &BootconfigParser) {
unsafe {
ostree_sys::ostree_deployment_set_bootconfig(self.to_glib_none().0, bootconfig.to_glib_none().0);
}
}
pub fn set_bootserial(&self, index: i32) {
unsafe {
ostree_sys::ostree_deployment_set_bootserial(self.to_glib_none().0, index);
}
}
pub fn set_index(&self, index: i32) {
unsafe {
ostree_sys::ostree_deployment_set_index(self.to_glib_none().0, index);
}
}
pub fn set_origin(&self, origin: &glib::KeyFile) {
unsafe {
ostree_sys::ostree_deployment_set_origin(self.to_glib_none().0, origin.to_glib_none().0);
}
}
pub fn hash(&self) -> u32 {
unsafe {
ffi::ostree_deployment_hash(ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(self).0 as glib_ffi::gconstpointer)
ostree_sys::ostree_deployment_hash(ToGlibPtr::<*mut ostree_sys::OstreeDeployment>::to_glib_none(self).0 as glib_sys::gconstpointer)
}
}
#[cfg(any(feature = "v2018_3", feature = "dox"))]
pub fn origin_remove_transient_state(origin: &glib::KeyFile) {
unsafe {
ffi::ostree_deployment_origin_remove_transient_state(origin.to_glib_none().0);
ostree_sys::ostree_deployment_origin_remove_transient_state(origin.to_glib_none().0);
}
}
#[cfg(any(feature = "v2016_4", feature = "dox"))]
pub fn unlocked_state_to_string(state: DeploymentUnlockedState) -> Option<String> {
pub fn unlocked_state_to_string(state: DeploymentUnlockedState) -> Option<GString> {
unsafe {
from_glib_none(ffi::ostree_deployment_unlocked_state_to_string(state.to_glib()))
from_glib_none(ostree_sys::ostree_deployment_unlocked_state_to_string(state.to_glib()))
}
}
}
pub trait DeploymentExt {
fn clone(&self) -> Option<Deployment>;
fn equal(&self, bp: &Deployment) -> bool;
fn get_bootconfig(&self) -> Option<BootconfigParser>;
fn get_bootcsum(&self) -> Option<String>;
fn get_bootserial(&self) -> i32;
fn get_csum(&self) -> Option<String>;
fn get_deployserial(&self) -> i32;
fn get_index(&self) -> i32;
fn get_origin(&self) -> Option<glib::KeyFile>;
fn get_origin_relpath(&self) -> Option<String>;
fn get_osname(&self) -> Option<String>;
#[cfg(any(feature = "v2016_4", feature = "dox"))]
fn get_unlocked(&self) -> DeploymentUnlockedState;
#[cfg(any(feature = "v2018_3", feature = "dox"))]
fn is_pinned(&self) -> bool;
#[cfg(any(feature = "v2018_3", feature = "dox"))]
fn is_staged(&self) -> bool;
fn set_bootconfig(&self, bootconfig: &BootconfigParser);
fn set_bootserial(&self, index: i32);
fn set_index(&self, index: i32);
fn set_origin(&self, origin: &glib::KeyFile);
}
impl<O: IsA<Deployment>> DeploymentExt for O {
fn clone(&self) -> Option<Deployment> {
unsafe {
from_glib_full(ffi::ostree_deployment_clone(self.to_glib_none().0))
}
}
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))
}
}
fn get_bootconfig(&self) -> Option<BootconfigParser> {
unsafe {
from_glib_none(ffi::ostree_deployment_get_bootconfig(self.to_glib_none().0))
}
}
fn get_bootcsum(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::ostree_deployment_get_bootcsum(self.to_glib_none().0))
}
}
fn get_bootserial(&self) -> i32 {
unsafe {
ffi::ostree_deployment_get_bootserial(self.to_glib_none().0)
}
}
fn get_csum(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::ostree_deployment_get_csum(self.to_glib_none().0))
}
}
fn get_deployserial(&self) -> i32 {
unsafe {
ffi::ostree_deployment_get_deployserial(self.to_glib_none().0)
}
}
fn get_index(&self) -> i32 {
unsafe {
ffi::ostree_deployment_get_index(self.to_glib_none().0)
}
}
fn get_origin(&self) -> Option<glib::KeyFile> {
unsafe {
from_glib_none(ffi::ostree_deployment_get_origin(self.to_glib_none().0))
}
}
fn get_origin_relpath(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::ostree_deployment_get_origin_relpath(self.to_glib_none().0))
}
}
fn get_osname(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::ostree_deployment_get_osname(self.to_glib_none().0))
}
}
#[cfg(any(feature = "v2016_4", feature = "dox"))]
fn get_unlocked(&self) -> DeploymentUnlockedState {
unsafe {
from_glib(ffi::ostree_deployment_get_unlocked(self.to_glib_none().0))
}
}
#[cfg(any(feature = "v2018_3", feature = "dox"))]
fn is_pinned(&self) -> bool {
unsafe {
from_glib(ffi::ostree_deployment_is_pinned(self.to_glib_none().0))
}
}
#[cfg(any(feature = "v2018_3", feature = "dox"))]
fn is_staged(&self) -> bool {
unsafe {
from_glib(ffi::ostree_deployment_is_staged(self.to_glib_none().0))
}
}
fn set_bootconfig(&self, bootconfig: &BootconfigParser) {
unsafe {
ffi::ostree_deployment_set_bootconfig(self.to_glib_none().0, bootconfig.to_glib_none().0);
}
}
fn set_bootserial(&self, index: i32) {
unsafe {
ffi::ostree_deployment_set_bootserial(self.to_glib_none().0, index);
}
}
fn set_index(&self, index: i32) {
unsafe {
ffi::ostree_deployment_set_index(self.to_glib_none().0, index);
}
}
fn set_origin(&self, origin: &glib::KeyFile) {
unsafe {
ffi::ostree_deployment_set_origin(self.to_glib_none().0, origin.to_glib_none().0);
}
impl fmt::Display for Deployment {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Deployment")
}
}

View File

@ -2,8 +2,9 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use ffi;
use glib::translate::*;
use ostree_sys;
use std::fmt;
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
@ -15,23 +16,34 @@ pub enum DeploymentUnlockedState {
__Unknown(i32),
}
impl fmt::Display for DeploymentUnlockedState {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "DeploymentUnlockedState::{}", match *self {
DeploymentUnlockedState::None => "None",
DeploymentUnlockedState::Development => "Development",
DeploymentUnlockedState::Hotfix => "Hotfix",
_ => "Unknown",
})
}
}
#[doc(hidden)]
impl ToGlib for DeploymentUnlockedState {
type GlibType = ffi::OstreeDeploymentUnlockedState;
type GlibType = ostree_sys::OstreeDeploymentUnlockedState;
fn to_glib(&self) -> ffi::OstreeDeploymentUnlockedState {
fn to_glib(&self) -> ostree_sys::OstreeDeploymentUnlockedState {
match *self {
DeploymentUnlockedState::None => ffi::OSTREE_DEPLOYMENT_UNLOCKED_NONE,
DeploymentUnlockedState::Development => ffi::OSTREE_DEPLOYMENT_UNLOCKED_DEVELOPMENT,
DeploymentUnlockedState::Hotfix => ffi::OSTREE_DEPLOYMENT_UNLOCKED_HOTFIX,
DeploymentUnlockedState::None => ostree_sys::OSTREE_DEPLOYMENT_UNLOCKED_NONE,
DeploymentUnlockedState::Development => ostree_sys::OSTREE_DEPLOYMENT_UNLOCKED_DEVELOPMENT,
DeploymentUnlockedState::Hotfix => ostree_sys::OSTREE_DEPLOYMENT_UNLOCKED_HOTFIX,
DeploymentUnlockedState::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeDeploymentUnlockedState> for DeploymentUnlockedState {
fn from_glib(value: ffi::OstreeDeploymentUnlockedState) -> Self {
impl FromGlib<ostree_sys::OstreeDeploymentUnlockedState> for DeploymentUnlockedState {
fn from_glib(value: ostree_sys::OstreeDeploymentUnlockedState) -> Self {
match value {
0 => DeploymentUnlockedState::None,
1 => DeploymentUnlockedState::Development,
@ -49,21 +61,30 @@ pub enum GpgSignatureFormatFlags {
__Unknown(i32),
}
impl fmt::Display for GpgSignatureFormatFlags {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "GpgSignatureFormatFlags::{}", match *self {
GpgSignatureFormatFlags::GpgSignatureFormatDefault => "GpgSignatureFormatDefault",
_ => "Unknown",
})
}
}
#[doc(hidden)]
impl ToGlib for GpgSignatureFormatFlags {
type GlibType = ffi::OstreeGpgSignatureFormatFlags;
type GlibType = ostree_sys::OstreeGpgSignatureFormatFlags;
fn to_glib(&self) -> ffi::OstreeGpgSignatureFormatFlags {
fn to_glib(&self) -> ostree_sys::OstreeGpgSignatureFormatFlags {
match *self {
GpgSignatureFormatFlags::GpgSignatureFormatDefault => ffi::OSTREE_GPG_SIGNATURE_FORMAT_DEFAULT,
GpgSignatureFormatFlags::GpgSignatureFormatDefault => ostree_sys::OSTREE_GPG_SIGNATURE_FORMAT_DEFAULT,
GpgSignatureFormatFlags::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeGpgSignatureFormatFlags> for GpgSignatureFormatFlags {
fn from_glib(value: ffi::OstreeGpgSignatureFormatFlags) -> Self {
impl FromGlib<ostree_sys::OstreeGpgSignatureFormatFlags> for GpgSignatureFormatFlags {
fn from_glib(value: ostree_sys::OstreeGpgSignatureFormatFlags) -> Self {
match value {
0 => GpgSignatureFormatFlags::GpgSignatureFormatDefault,
value => GpgSignatureFormatFlags::__Unknown(value),
@ -85,27 +106,42 @@ pub enum ObjectType {
__Unknown(i32),
}
impl fmt::Display for ObjectType {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "ObjectType::{}", match *self {
ObjectType::File => "File",
ObjectType::DirTree => "DirTree",
ObjectType::DirMeta => "DirMeta",
ObjectType::Commit => "Commit",
ObjectType::TombstoneCommit => "TombstoneCommit",
ObjectType::CommitMeta => "CommitMeta",
ObjectType::PayloadLink => "PayloadLink",
_ => "Unknown",
})
}
}
#[doc(hidden)]
impl ToGlib for ObjectType {
type GlibType = ffi::OstreeObjectType;
type GlibType = ostree_sys::OstreeObjectType;
fn to_glib(&self) -> ffi::OstreeObjectType {
fn to_glib(&self) -> ostree_sys::OstreeObjectType {
match *self {
ObjectType::File => ffi::OSTREE_OBJECT_TYPE_FILE,
ObjectType::DirTree => ffi::OSTREE_OBJECT_TYPE_DIR_TREE,
ObjectType::DirMeta => ffi::OSTREE_OBJECT_TYPE_DIR_META,
ObjectType::Commit => ffi::OSTREE_OBJECT_TYPE_COMMIT,
ObjectType::TombstoneCommit => ffi::OSTREE_OBJECT_TYPE_TOMBSTONE_COMMIT,
ObjectType::CommitMeta => ffi::OSTREE_OBJECT_TYPE_COMMIT_META,
ObjectType::PayloadLink => ffi::OSTREE_OBJECT_TYPE_PAYLOAD_LINK,
ObjectType::File => ostree_sys::OSTREE_OBJECT_TYPE_FILE,
ObjectType::DirTree => ostree_sys::OSTREE_OBJECT_TYPE_DIR_TREE,
ObjectType::DirMeta => ostree_sys::OSTREE_OBJECT_TYPE_DIR_META,
ObjectType::Commit => ostree_sys::OSTREE_OBJECT_TYPE_COMMIT,
ObjectType::TombstoneCommit => ostree_sys::OSTREE_OBJECT_TYPE_TOMBSTONE_COMMIT,
ObjectType::CommitMeta => ostree_sys::OSTREE_OBJECT_TYPE_COMMIT_META,
ObjectType::PayloadLink => ostree_sys::OSTREE_OBJECT_TYPE_PAYLOAD_LINK,
ObjectType::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeObjectType> for ObjectType {
fn from_glib(value: ffi::OstreeObjectType) -> Self {
impl FromGlib<ostree_sys::OstreeObjectType> for ObjectType {
fn from_glib(value: ostree_sys::OstreeObjectType) -> Self {
match value {
1 => ObjectType::File,
2 => ObjectType::DirTree,
@ -128,22 +164,32 @@ pub enum RepoCheckoutMode {
__Unknown(i32),
}
impl fmt::Display for RepoCheckoutMode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "RepoCheckoutMode::{}", match *self {
RepoCheckoutMode::None => "None",
RepoCheckoutMode::User => "User",
_ => "Unknown",
})
}
}
#[doc(hidden)]
impl ToGlib for RepoCheckoutMode {
type GlibType = ffi::OstreeRepoCheckoutMode;
type GlibType = ostree_sys::OstreeRepoCheckoutMode;
fn to_glib(&self) -> ffi::OstreeRepoCheckoutMode {
fn to_glib(&self) -> ostree_sys::OstreeRepoCheckoutMode {
match *self {
RepoCheckoutMode::None => ffi::OSTREE_REPO_CHECKOUT_MODE_NONE,
RepoCheckoutMode::User => ffi::OSTREE_REPO_CHECKOUT_MODE_USER,
RepoCheckoutMode::None => ostree_sys::OSTREE_REPO_CHECKOUT_MODE_NONE,
RepoCheckoutMode::User => ostree_sys::OSTREE_REPO_CHECKOUT_MODE_USER,
RepoCheckoutMode::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoCheckoutMode> for RepoCheckoutMode {
fn from_glib(value: ffi::OstreeRepoCheckoutMode) -> Self {
impl FromGlib<ostree_sys::OstreeRepoCheckoutMode> for RepoCheckoutMode {
fn from_glib(value: ostree_sys::OstreeRepoCheckoutMode) -> Self {
match value {
0 => RepoCheckoutMode::None,
1 => RepoCheckoutMode::User,
@ -163,24 +209,36 @@ pub enum RepoCheckoutOverwriteMode {
__Unknown(i32),
}
impl fmt::Display for RepoCheckoutOverwriteMode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "RepoCheckoutOverwriteMode::{}", match *self {
RepoCheckoutOverwriteMode::None => "None",
RepoCheckoutOverwriteMode::UnionFiles => "UnionFiles",
RepoCheckoutOverwriteMode::AddFiles => "AddFiles",
RepoCheckoutOverwriteMode::UnionIdentical => "UnionIdentical",
_ => "Unknown",
})
}
}
#[doc(hidden)]
impl ToGlib for RepoCheckoutOverwriteMode {
type GlibType = ffi::OstreeRepoCheckoutOverwriteMode;
type GlibType = ostree_sys::OstreeRepoCheckoutOverwriteMode;
fn to_glib(&self) -> ffi::OstreeRepoCheckoutOverwriteMode {
fn to_glib(&self) -> ostree_sys::OstreeRepoCheckoutOverwriteMode {
match *self {
RepoCheckoutOverwriteMode::None => ffi::OSTREE_REPO_CHECKOUT_OVERWRITE_NONE,
RepoCheckoutOverwriteMode::UnionFiles => ffi::OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES,
RepoCheckoutOverwriteMode::AddFiles => ffi::OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES,
RepoCheckoutOverwriteMode::UnionIdentical => ffi::OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL,
RepoCheckoutOverwriteMode::None => ostree_sys::OSTREE_REPO_CHECKOUT_OVERWRITE_NONE,
RepoCheckoutOverwriteMode::UnionFiles => ostree_sys::OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES,
RepoCheckoutOverwriteMode::AddFiles => ostree_sys::OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES,
RepoCheckoutOverwriteMode::UnionIdentical => ostree_sys::OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL,
RepoCheckoutOverwriteMode::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoCheckoutOverwriteMode> for RepoCheckoutOverwriteMode {
fn from_glib(value: ffi::OstreeRepoCheckoutOverwriteMode) -> Self {
impl FromGlib<ostree_sys::OstreeRepoCheckoutOverwriteMode> for RepoCheckoutOverwriteMode {
fn from_glib(value: ostree_sys::OstreeRepoCheckoutOverwriteMode) -> Self {
match value {
0 => RepoCheckoutOverwriteMode::None,
1 => RepoCheckoutOverwriteMode::UnionFiles,
@ -202,24 +260,36 @@ pub enum RepoMode {
__Unknown(i32),
}
impl fmt::Display for RepoMode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "RepoMode::{}", match *self {
RepoMode::Bare => "Bare",
RepoMode::Archive => "Archive",
RepoMode::BareUser => "BareUser",
RepoMode::BareUserOnly => "BareUserOnly",
_ => "Unknown",
})
}
}
#[doc(hidden)]
impl ToGlib for RepoMode {
type GlibType = ffi::OstreeRepoMode;
type GlibType = ostree_sys::OstreeRepoMode;
fn to_glib(&self) -> ffi::OstreeRepoMode {
fn to_glib(&self) -> ostree_sys::OstreeRepoMode {
match *self {
RepoMode::Bare => ffi::OSTREE_REPO_MODE_BARE,
RepoMode::Archive => ffi::OSTREE_REPO_MODE_ARCHIVE,
RepoMode::BareUser => ffi::OSTREE_REPO_MODE_BARE_USER,
RepoMode::BareUserOnly => ffi::OSTREE_REPO_MODE_BARE_USER_ONLY,
RepoMode::Bare => ostree_sys::OSTREE_REPO_MODE_BARE,
RepoMode::Archive => ostree_sys::OSTREE_REPO_MODE_ARCHIVE,
RepoMode::BareUser => ostree_sys::OSTREE_REPO_MODE_BARE_USER,
RepoMode::BareUserOnly => ostree_sys::OSTREE_REPO_MODE_BARE_USER_ONLY,
RepoMode::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoMode> for RepoMode {
fn from_glib(value: ffi::OstreeRepoMode) -> Self {
impl FromGlib<ostree_sys::OstreeRepoMode> for RepoMode {
fn from_glib(value: ostree_sys::OstreeRepoMode) -> Self {
match value {
0 => RepoMode::Bare,
1 => RepoMode::Archive,
@ -240,23 +310,34 @@ pub enum RepoPruneFlags {
__Unknown(i32),
}
impl fmt::Display for RepoPruneFlags {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "RepoPruneFlags::{}", match *self {
RepoPruneFlags::None => "None",
RepoPruneFlags::NoPrune => "NoPrune",
RepoPruneFlags::RefsOnly => "RefsOnly",
_ => "Unknown",
})
}
}
#[doc(hidden)]
impl ToGlib for RepoPruneFlags {
type GlibType = ffi::OstreeRepoPruneFlags;
type GlibType = ostree_sys::OstreeRepoPruneFlags;
fn to_glib(&self) -> ffi::OstreeRepoPruneFlags {
fn to_glib(&self) -> ostree_sys::OstreeRepoPruneFlags {
match *self {
RepoPruneFlags::None => ffi::OSTREE_REPO_PRUNE_FLAGS_NONE,
RepoPruneFlags::NoPrune => ffi::OSTREE_REPO_PRUNE_FLAGS_NO_PRUNE,
RepoPruneFlags::RefsOnly => ffi::OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY,
RepoPruneFlags::None => ostree_sys::OSTREE_REPO_PRUNE_FLAGS_NONE,
RepoPruneFlags::NoPrune => ostree_sys::OSTREE_REPO_PRUNE_FLAGS_NO_PRUNE,
RepoPruneFlags::RefsOnly => ostree_sys::OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY,
RepoPruneFlags::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoPruneFlags> for RepoPruneFlags {
fn from_glib(value: ffi::OstreeRepoPruneFlags) -> Self {
impl FromGlib<ostree_sys::OstreeRepoPruneFlags> for RepoPruneFlags {
fn from_glib(value: ostree_sys::OstreeRepoPruneFlags) -> Self {
match value {
0 => RepoPruneFlags::None,
1 => RepoPruneFlags::NoPrune,
@ -278,25 +359,38 @@ pub enum RepoRemoteChange {
__Unknown(i32),
}
impl fmt::Display for RepoRemoteChange {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "RepoRemoteChange::{}", match *self {
RepoRemoteChange::Add => "Add",
RepoRemoteChange::AddIfNotExists => "AddIfNotExists",
RepoRemoteChange::Delete => "Delete",
RepoRemoteChange::DeleteIfExists => "DeleteIfExists",
RepoRemoteChange::Replace => "Replace",
_ => "Unknown",
})
}
}
#[doc(hidden)]
impl ToGlib for RepoRemoteChange {
type GlibType = ffi::OstreeRepoRemoteChange;
type GlibType = ostree_sys::OstreeRepoRemoteChange;
fn to_glib(&self) -> ffi::OstreeRepoRemoteChange {
fn to_glib(&self) -> ostree_sys::OstreeRepoRemoteChange {
match *self {
RepoRemoteChange::Add => ffi::OSTREE_REPO_REMOTE_CHANGE_ADD,
RepoRemoteChange::AddIfNotExists => ffi::OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS,
RepoRemoteChange::Delete => ffi::OSTREE_REPO_REMOTE_CHANGE_DELETE,
RepoRemoteChange::DeleteIfExists => ffi::OSTREE_REPO_REMOTE_CHANGE_DELETE_IF_EXISTS,
RepoRemoteChange::Replace => ffi::OSTREE_REPO_REMOTE_CHANGE_REPLACE,
RepoRemoteChange::Add => ostree_sys::OSTREE_REPO_REMOTE_CHANGE_ADD,
RepoRemoteChange::AddIfNotExists => ostree_sys::OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS,
RepoRemoteChange::Delete => ostree_sys::OSTREE_REPO_REMOTE_CHANGE_DELETE,
RepoRemoteChange::DeleteIfExists => ostree_sys::OSTREE_REPO_REMOTE_CHANGE_DELETE_IF_EXISTS,
RepoRemoteChange::Replace => ostree_sys::OSTREE_REPO_REMOTE_CHANGE_REPLACE,
RepoRemoteChange::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoRemoteChange> for RepoRemoteChange {
fn from_glib(value: ffi::OstreeRepoRemoteChange) -> Self {
impl FromGlib<ostree_sys::OstreeRepoRemoteChange> for RepoRemoteChange {
fn from_glib(value: ostree_sys::OstreeRepoRemoteChange) -> Self {
match value {
0 => RepoRemoteChange::Add,
1 => RepoRemoteChange::AddIfNotExists,
@ -317,22 +411,32 @@ pub enum StaticDeltaGenerateOpt {
__Unknown(i32),
}
impl fmt::Display for StaticDeltaGenerateOpt {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "StaticDeltaGenerateOpt::{}", match *self {
StaticDeltaGenerateOpt::Lowlatency => "Lowlatency",
StaticDeltaGenerateOpt::Major => "Major",
_ => "Unknown",
})
}
}
#[doc(hidden)]
impl ToGlib for StaticDeltaGenerateOpt {
type GlibType = ffi::OstreeStaticDeltaGenerateOpt;
type GlibType = ostree_sys::OstreeStaticDeltaGenerateOpt;
fn to_glib(&self) -> ffi::OstreeStaticDeltaGenerateOpt {
fn to_glib(&self) -> ostree_sys::OstreeStaticDeltaGenerateOpt {
match *self {
StaticDeltaGenerateOpt::Lowlatency => ffi::OSTREE_STATIC_DELTA_GENERATE_OPT_LOWLATENCY,
StaticDeltaGenerateOpt::Major => ffi::OSTREE_STATIC_DELTA_GENERATE_OPT_MAJOR,
StaticDeltaGenerateOpt::Lowlatency => ostree_sys::OSTREE_STATIC_DELTA_GENERATE_OPT_LOWLATENCY,
StaticDeltaGenerateOpt::Major => ostree_sys::OSTREE_STATIC_DELTA_GENERATE_OPT_MAJOR,
StaticDeltaGenerateOpt::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeStaticDeltaGenerateOpt> for StaticDeltaGenerateOpt {
fn from_glib(value: ffi::OstreeStaticDeltaGenerateOpt) -> Self {
impl FromGlib<ostree_sys::OstreeStaticDeltaGenerateOpt> for StaticDeltaGenerateOpt {
fn from_glib(value: ostree_sys::OstreeStaticDeltaGenerateOpt) -> Self {
match value {
0 => StaticDeltaGenerateOpt::Lowlatency,
1 => StaticDeltaGenerateOpt::Major,

View File

@ -2,7 +2,6 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use ffi;
use glib::StaticType;
use glib::Type;
use glib::translate::*;
@ -10,7 +9,8 @@ use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use gobject_ffi;
use gobject_sys;
use ostree_sys;
#[cfg(any(feature = "v2015_7", feature = "dox"))]
bitflags! {
@ -23,17 +23,17 @@ bitflags! {
#[cfg(any(feature = "v2015_7", feature = "dox"))]
#[doc(hidden)]
impl ToGlib for RepoCommitState {
type GlibType = ffi::OstreeRepoCommitState;
type GlibType = ostree_sys::OstreeRepoCommitState;
fn to_glib(&self) -> ffi::OstreeRepoCommitState {
fn to_glib(&self) -> ostree_sys::OstreeRepoCommitState {
self.bits()
}
}
#[cfg(any(feature = "v2015_7", feature = "dox"))]
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoCommitState> for RepoCommitState {
fn from_glib(value: ffi::OstreeRepoCommitState) -> RepoCommitState {
impl FromGlib<ostree_sys::OstreeRepoCommitState> for RepoCommitState {
fn from_glib(value: ostree_sys::OstreeRepoCommitState) -> RepoCommitState {
RepoCommitState::from_bits_truncate(value)
}
}
@ -49,16 +49,16 @@ bitflags! {
#[doc(hidden)]
impl ToGlib for RepoListRefsExtFlags {
type GlibType = ffi::OstreeRepoListRefsExtFlags;
type GlibType = ostree_sys::OstreeRepoListRefsExtFlags;
fn to_glib(&self) -> ffi::OstreeRepoListRefsExtFlags {
fn to_glib(&self) -> ostree_sys::OstreeRepoListRefsExtFlags {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoListRefsExtFlags> for RepoListRefsExtFlags {
fn from_glib(value: ffi::OstreeRepoListRefsExtFlags) -> RepoListRefsExtFlags {
impl FromGlib<ostree_sys::OstreeRepoListRefsExtFlags> for RepoListRefsExtFlags {
fn from_glib(value: ostree_sys::OstreeRepoListRefsExtFlags) -> RepoListRefsExtFlags {
RepoListRefsExtFlags::from_bits_truncate(value)
}
}
@ -76,16 +76,16 @@ bitflags! {
#[doc(hidden)]
impl ToGlib for RepoPullFlags {
type GlibType = ffi::OstreeRepoPullFlags;
type GlibType = ostree_sys::OstreeRepoPullFlags;
fn to_glib(&self) -> ffi::OstreeRepoPullFlags {
fn to_glib(&self) -> ostree_sys::OstreeRepoPullFlags {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoPullFlags> for RepoPullFlags {
fn from_glib(value: ffi::OstreeRepoPullFlags) -> RepoPullFlags {
impl FromGlib<ostree_sys::OstreeRepoPullFlags> for RepoPullFlags {
fn from_glib(value: ostree_sys::OstreeRepoPullFlags) -> RepoPullFlags {
RepoPullFlags::from_bits_truncate(value)
}
}
@ -99,16 +99,16 @@ bitflags! {
#[doc(hidden)]
impl ToGlib for RepoResolveRevExtFlags {
type GlibType = ffi::OstreeRepoResolveRevExtFlags;
type GlibType = ostree_sys::OstreeRepoResolveRevExtFlags;
fn to_glib(&self) -> ffi::OstreeRepoResolveRevExtFlags {
fn to_glib(&self) -> ostree_sys::OstreeRepoResolveRevExtFlags {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoResolveRevExtFlags> for RepoResolveRevExtFlags {
fn from_glib(value: ffi::OstreeRepoResolveRevExtFlags) -> RepoResolveRevExtFlags {
impl FromGlib<ostree_sys::OstreeRepoResolveRevExtFlags> for RepoResolveRevExtFlags {
fn from_glib(value: ostree_sys::OstreeRepoResolveRevExtFlags) -> RepoResolveRevExtFlags {
RepoResolveRevExtFlags::from_bits_truncate(value)
}
}
@ -123,16 +123,16 @@ bitflags! {
#[doc(hidden)]
impl ToGlib for SePolicyRestoreconFlags {
type GlibType = ffi::OstreeSePolicyRestoreconFlags;
type GlibType = ostree_sys::OstreeSePolicyRestoreconFlags;
fn to_glib(&self) -> ffi::OstreeSePolicyRestoreconFlags {
fn to_glib(&self) -> ostree_sys::OstreeSePolicyRestoreconFlags {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeSePolicyRestoreconFlags> for SePolicyRestoreconFlags {
fn from_glib(value: ffi::OstreeSePolicyRestoreconFlags) -> SePolicyRestoreconFlags {
impl FromGlib<ostree_sys::OstreeSePolicyRestoreconFlags> for SePolicyRestoreconFlags {
fn from_glib(value: ostree_sys::OstreeSePolicyRestoreconFlags) -> SePolicyRestoreconFlags {
SePolicyRestoreconFlags::from_bits_truncate(value)
}
}
@ -150,16 +150,16 @@ bitflags! {
#[doc(hidden)]
impl ToGlib for SysrootSimpleWriteDeploymentFlags {
type GlibType = ffi::OstreeSysrootSimpleWriteDeploymentFlags;
type GlibType = ostree_sys::OstreeSysrootSimpleWriteDeploymentFlags;
fn to_glib(&self) -> ffi::OstreeSysrootSimpleWriteDeploymentFlags {
fn to_glib(&self) -> ostree_sys::OstreeSysrootSimpleWriteDeploymentFlags {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeSysrootSimpleWriteDeploymentFlags> for SysrootSimpleWriteDeploymentFlags {
fn from_glib(value: ffi::OstreeSysrootSimpleWriteDeploymentFlags) -> SysrootSimpleWriteDeploymentFlags {
impl FromGlib<ostree_sys::OstreeSysrootSimpleWriteDeploymentFlags> for SysrootSimpleWriteDeploymentFlags {
fn from_glib(value: ostree_sys::OstreeSysrootSimpleWriteDeploymentFlags) -> SysrootSimpleWriteDeploymentFlags {
SysrootSimpleWriteDeploymentFlags::from_bits_truncate(value)
}
}
@ -172,23 +172,23 @@ bitflags! {
#[doc(hidden)]
impl ToGlib for SysrootUpgraderFlags {
type GlibType = ffi::OstreeSysrootUpgraderFlags;
type GlibType = ostree_sys::OstreeSysrootUpgraderFlags;
fn to_glib(&self) -> ffi::OstreeSysrootUpgraderFlags {
fn to_glib(&self) -> ostree_sys::OstreeSysrootUpgraderFlags {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeSysrootUpgraderFlags> for SysrootUpgraderFlags {
fn from_glib(value: ffi::OstreeSysrootUpgraderFlags) -> SysrootUpgraderFlags {
impl FromGlib<ostree_sys::OstreeSysrootUpgraderFlags> for SysrootUpgraderFlags {
fn from_glib(value: ostree_sys::OstreeSysrootUpgraderFlags) -> SysrootUpgraderFlags {
SysrootUpgraderFlags::from_bits_truncate(value)
}
}
impl StaticType for SysrootUpgraderFlags {
fn static_type() -> Type {
unsafe { from_glib(ffi::ostree_sysroot_upgrader_flags_get_type()) }
unsafe { from_glib(ostree_sys::ostree_sysroot_upgrader_flags_get_type()) }
}
}
@ -200,13 +200,13 @@ impl<'a> FromValueOptional<'a> for SysrootUpgraderFlags {
impl<'a> FromValue<'a> for SysrootUpgraderFlags {
unsafe fn from_value(value: &Value) -> Self {
from_glib(gobject_ffi::g_value_get_flags(value.to_glib_none().0))
from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
}
}
impl SetValue for SysrootUpgraderFlags {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
}
}
@ -220,16 +220,16 @@ bitflags! {
#[doc(hidden)]
impl ToGlib for SysrootUpgraderPullFlags {
type GlibType = ffi::OstreeSysrootUpgraderPullFlags;
type GlibType = ostree_sys::OstreeSysrootUpgraderPullFlags;
fn to_glib(&self) -> ffi::OstreeSysrootUpgraderPullFlags {
fn to_glib(&self) -> ostree_sys::OstreeSysrootUpgraderPullFlags {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeSysrootUpgraderPullFlags> for SysrootUpgraderPullFlags {
fn from_glib(value: ffi::OstreeSysrootUpgraderPullFlags) -> SysrootUpgraderPullFlags {
impl FromGlib<ostree_sys::OstreeSysrootUpgraderPullFlags> for SysrootUpgraderPullFlags {
fn from_glib(value: ostree_sys::OstreeSysrootUpgraderPullFlags) -> SysrootUpgraderPullFlags {
SysrootUpgraderPullFlags::from_bits_truncate(value)
}
}

View File

@ -4,22 +4,21 @@
use Error;
use ObjectType;
use ffi;
use gio;
use glib;
use glib::GString;
use glib::object::IsA;
use glib::translate::*;
use ostree_sys;
use std::mem;
use std::ptr;
#[cfg(any(feature = "v2017_15", feature = "dox"))]
pub fn break_hardlink<'a, P: Into<Option<&'a gio::Cancellable>>>(dfd: i32, path: &str, skip_xattrs: bool, cancellable: P) -> Result<(), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn break_hardlink<P: IsA<gio::Cancellable>>(dfd: i32, path: &str, skip_xattrs: bool, cancellable: Option<&P>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_break_hardlink(dfd, path.to_glib_none().0, skip_xattrs.to_glib(), cancellable.0, &mut error);
let _ = ostree_sys::ostree_break_hardlink(dfd, path.to_glib_none().0, skip_xattrs.to_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -27,265 +26,243 @@ pub fn break_hardlink<'a, P: Into<Option<&'a gio::Cancellable>>>(dfd: i32, path:
#[cfg(any(feature = "v2017_4", feature = "dox"))]
pub fn check_version(required_year: u32, required_release: u32) -> bool {
unsafe {
from_glib(ffi::ostree_check_version(required_year, required_release))
from_glib(ostree_sys::ostree_check_version(required_year, required_release))
}
}
//#[cfg(any(feature = "v2016_8", feature = "dox"))]
//pub fn checksum_b64_from_bytes(csum: /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32) -> Option<String> {
// unsafe { TODO: call ffi::ostree_checksum_b64_from_bytes() }
//pub fn checksum_b64_from_bytes(csum: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32) -> Option<GString> {
// unsafe { TODO: call ostree_sys:ostree_checksum_b64_from_bytes() }
//}
//pub fn checksum_b64_inplace_from_bytes(csum: /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, buf: &str) {
// unsafe { TODO: call ffi::ostree_checksum_b64_inplace_from_bytes() }
//pub fn checksum_b64_inplace_from_bytes(csum: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, buf: &str) {
// unsafe { TODO: call ostree_sys:ostree_checksum_b64_inplace_from_bytes() }
//}
//pub fn checksum_b64_inplace_to_bytes(checksum: /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 28 }; 32, buf: u8) {
// unsafe { TODO: call ffi::ostree_checksum_b64_inplace_to_bytes() }
//pub fn checksum_b64_inplace_to_bytes(checksum: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 28 }; 32, buf: u8) {
// unsafe { TODO: call ostree_sys:ostree_checksum_b64_inplace_to_bytes() }
//}
//#[cfg(any(feature = "v2016_8", feature = "dox"))]
//pub fn checksum_b64_to_bytes(checksum: &str) -> /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32 {
// unsafe { TODO: call ffi::ostree_checksum_b64_to_bytes() }
//pub fn checksum_b64_to_bytes(checksum: &str) -> /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32 {
// unsafe { TODO: call ostree_sys:ostree_checksum_b64_to_bytes() }
//}
//pub fn checksum_bytes_peek(bytes: &glib::Variant) -> /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32 {
// unsafe { TODO: call ffi::ostree_checksum_bytes_peek() }
//pub fn checksum_bytes_peek(bytes: &glib::Variant) -> /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32 {
// unsafe { TODO: call ostree_sys:ostree_checksum_bytes_peek() }
//}
//pub fn checksum_bytes_peek_validate(bytes: &glib::Variant) -> Result</*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, Error> {
// unsafe { TODO: call ffi::ostree_checksum_bytes_peek_validate() }
//pub fn checksum_bytes_peek_validate(bytes: &glib::Variant) -> Result</*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, Error> {
// unsafe { TODO: call ostree_sys:ostree_checksum_bytes_peek_validate() }
//}
//pub fn checksum_file<'a, P: IsA<gio::File>, Q: Into<Option<&'a gio::Cancellable>>>(f: &P, objtype: ObjectType, out_csum: /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, cancellable: Q) -> Result<(), Error> {
// unsafe { TODO: call ffi::ostree_checksum_file() }
//pub fn checksum_file<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(f: &P, objtype: ObjectType, out_csum: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, cancellable: Option<&Q>) -> Result<(), Error> {
// unsafe { TODO: call ostree_sys:ostree_checksum_file() }
//}
//pub fn checksum_file_async<'a, P: IsA<gio::File>, Q: Into<Option<&'a gio::Cancellable>>, R: /*Ignored*/gio::AsyncReadyCallback>(f: &P, objtype: ObjectType, io_priority: i32, cancellable: Q, callback: R) {
// unsafe { TODO: call ffi::ostree_checksum_file_async() }
//pub fn checksum_file_async<P: IsA<gio::File>, Q: IsA<gio::Cancellable>, R: FnOnce(Result<(), Error>) + 'static>(f: &P, objtype: ObjectType, io_priority: i32, cancellable: Option<&Q>, callback: R) {
// unsafe { TODO: call ostree_sys:ostree_checksum_file_async() }
//}
//#[cfg(any(feature = "v2017_13", feature = "dox"))]
//pub fn checksum_file_at<'a, P: Into<Option</*Unimplemented*/Fundamental: Pointer>>, Q: Into<Option<&'a gio::Cancellable>>>(dfd: i32, path: &str, stbuf: P, objtype: ObjectType, flags: /*Ignored*/ChecksumFlags, out_checksum: &str, cancellable: Q) -> Result<(), Error> {
// unsafe { TODO: call ffi::ostree_checksum_file_at() }
//pub fn checksum_file_at<P: IsA<gio::Cancellable>>(dfd: i32, path: &str, stbuf: /*Unimplemented*/Option<Fundamental: Pointer>, objtype: ObjectType, flags: /*Ignored*/ChecksumFlags, out_checksum: &str, cancellable: Option<&P>) -> Result<(), Error> {
// unsafe { TODO: call ostree_sys:ostree_checksum_file_at() }
//}
//pub fn checksum_file_from_input<'a, 'b, 'c, P: Into<Option<&'a glib::Variant>>, Q: IsA<gio::InputStream> + 'b, R: Into<Option<&'b Q>>, S: Into<Option<&'c gio::Cancellable>>>(file_info: &gio::FileInfo, xattrs: P, in_: R, objtype: ObjectType, out_csum: /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, cancellable: S) -> Result<(), Error> {
// unsafe { TODO: call ffi::ostree_checksum_file_from_input() }
//pub fn checksum_file_from_input<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(file_info: &gio::FileInfo, xattrs: Option<&glib::Variant>, in_: Option<&P>, objtype: ObjectType, out_csum: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, cancellable: Option<&Q>) -> Result<(), Error> {
// unsafe { TODO: call ostree_sys:ostree_checksum_file_from_input() }
//}
//pub fn checksum_from_bytes(csum: /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32) -> Option<String> {
// unsafe { TODO: call ffi::ostree_checksum_from_bytes() }
//pub fn checksum_from_bytes(csum: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32) -> Option<GString> {
// unsafe { TODO: call ostree_sys:ostree_checksum_from_bytes() }
//}
pub fn checksum_from_bytes_v(csum_v: &glib::Variant) -> Option<String> {
pub fn checksum_from_bytes_v(csum_v: &glib::Variant) -> Option<GString> {
unsafe {
from_glib_full(ffi::ostree_checksum_from_bytes_v(csum_v.to_glib_none().0))
from_glib_full(ostree_sys::ostree_checksum_from_bytes_v(csum_v.to_glib_none().0))
}
}
//pub fn checksum_inplace_from_bytes(csum: /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, buf: &str) {
// unsafe { TODO: call ffi::ostree_checksum_inplace_from_bytes() }
//pub fn checksum_inplace_from_bytes(csum: /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, buf: &str) {
// unsafe { TODO: call ostree_sys:ostree_checksum_inplace_from_bytes() }
//}
//pub fn checksum_to_bytes(checksum: &str) -> /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32 {
// unsafe { TODO: call ffi::ostree_checksum_to_bytes() }
//pub fn checksum_to_bytes(checksum: &str) -> /*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32 {
// unsafe { TODO: call ostree_sys:ostree_checksum_to_bytes() }
//}
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))
from_glib_full(ostree_sys::ostree_checksum_to_bytes_v(checksum.to_glib_none().0))
}
}
//pub fn cmd__private__() -> /*Ignored*/Option<CmdPrivateVTable> {
// unsafe { TODO: call ffi::ostree_cmd__private__() }
// unsafe { TODO: call ostree_sys:ostree_cmd__private__() }
//}
#[cfg(any(feature = "v2018_2", feature = "dox"))]
pub fn commit_get_content_checksum(commit_variant: &glib::Variant) -> Option<String> {
pub fn commit_get_content_checksum(commit_variant: &glib::Variant) -> Option<GString> {
unsafe {
from_glib_full(ffi::ostree_commit_get_content_checksum(commit_variant.to_glib_none().0))
from_glib_full(ostree_sys::ostree_commit_get_content_checksum(commit_variant.to_glib_none().0))
}
}
pub fn commit_get_parent(commit_variant: &glib::Variant) -> Option<String> {
pub fn commit_get_parent(commit_variant: &glib::Variant) -> Option<GString> {
unsafe {
from_glib_full(ffi::ostree_commit_get_parent(commit_variant.to_glib_none().0))
from_glib_full(ostree_sys::ostree_commit_get_parent(commit_variant.to_glib_none().0))
}
}
pub fn commit_get_timestamp(commit_variant: &glib::Variant) -> u64 {
unsafe {
ffi::ostree_commit_get_timestamp(commit_variant.to_glib_none().0)
ostree_sys::ostree_commit_get_timestamp(commit_variant.to_glib_none().0)
}
}
pub fn content_file_parse<'a, P: IsA<gio::File>, Q: Into<Option<&'a gio::Cancellable>>>(compressed: bool, content_path: &P, trusted: bool, cancellable: Q) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn content_file_parse<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(compressed: bool, content_path: &P, trusted: bool, cancellable: Option<&Q>) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), Error> {
unsafe {
let mut out_input = ptr::null_mut();
let mut out_file_info = ptr::null_mut();
let mut out_xattrs = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ffi::ostree_content_file_parse(compressed.to_glib(), content_path.to_glib_none().0, trusted.to_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.0, &mut error);
let _ = ostree_sys::ostree_content_file_parse(compressed.to_glib(), content_path.as_ref().to_glib_none().0, trusted.to_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok((from_glib_full(out_input), from_glib_full(out_file_info), from_glib_full(out_xattrs))) } else { Err(from_glib_full(error)) }
}
}
pub fn content_file_parse_at<'a, P: Into<Option<&'a gio::Cancellable>>>(compressed: bool, parent_dfd: i32, path: &str, trusted: bool, cancellable: P) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn content_file_parse_at<P: IsA<gio::Cancellable>>(compressed: bool, parent_dfd: i32, path: &str, trusted: bool, cancellable: Option<&P>) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), Error> {
unsafe {
let mut out_input = ptr::null_mut();
let mut out_file_info = ptr::null_mut();
let mut out_xattrs = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ffi::ostree_content_file_parse_at(compressed.to_glib(), parent_dfd, path.to_glib_none().0, trusted.to_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.0, &mut error);
let _ = ostree_sys::ostree_content_file_parse_at(compressed.to_glib(), parent_dfd, path.to_glib_none().0, trusted.to_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok((from_glib_full(out_input), from_glib_full(out_file_info), from_glib_full(out_xattrs))) } else { Err(from_glib_full(error)) }
}
}
pub fn content_stream_parse<'a, P: IsA<gio::InputStream>, Q: Into<Option<&'a gio::Cancellable>>>(compressed: bool, input: &P, input_length: u64, trusted: bool, cancellable: Q) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn content_stream_parse<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(compressed: bool, input: &P, input_length: u64, trusted: bool, cancellable: Option<&Q>) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), Error> {
unsafe {
let mut out_input = ptr::null_mut();
let mut out_file_info = ptr::null_mut();
let mut out_xattrs = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ffi::ostree_content_stream_parse(compressed.to_glib(), input.to_glib_none().0, input_length, trusted.to_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.0, &mut error);
let _ = ostree_sys::ostree_content_stream_parse(compressed.to_glib(), input.as_ref().to_glib_none().0, input_length, trusted.to_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok((from_glib_full(out_input), from_glib_full(out_file_info), from_glib_full(out_xattrs))) } else { Err(from_glib_full(error)) }
}
}
pub fn create_directory_metadata<'a, P: Into<Option<&'a glib::Variant>>>(dir_info: &gio::FileInfo, xattrs: P) -> Option<glib::Variant> {
let xattrs = xattrs.into();
let xattrs = xattrs.to_glib_none();
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.0))
from_glib_full(ostree_sys::ostree_create_directory_metadata(dir_info.to_glib_none().0, xattrs.to_glib_none().0))
}
}
//pub fn diff_dirs<'a, P: IsA<gio::File>, Q: IsA<gio::File>, R: Into<Option<&'a gio::Cancellable>>>(flags: /*Ignored*/DiffFlags, a: &P, b: &Q, modified: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 24 }, removed: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 4, id: 15 }, added: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 4, id: 15 }, cancellable: R) -> Result<(), Error> {
// unsafe { TODO: call ffi::ostree_diff_dirs() }
//pub fn diff_dirs<P: IsA<gio::File>, Q: IsA<gio::File>, R: IsA<gio::Cancellable>>(flags: /*Ignored*/DiffFlags, a: &P, b: &Q, modified: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 24 }, removed: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 4, id: 15 }, added: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 4, id: 15 }, cancellable: Option<&R>) -> Result<(), Error> {
// unsafe { TODO: call ostree_sys:ostree_diff_dirs() }
//}
//#[cfg(any(feature = "v2017_4", feature = "dox"))]
//pub fn diff_dirs_with_options<'a, 'b, P: IsA<gio::File>, Q: IsA<gio::File>, R: Into<Option<&'a /*Ignored*/DiffDirsOptions>>, S: Into<Option<&'b gio::Cancellable>>>(flags: /*Ignored*/DiffFlags, a: &P, b: &Q, modified: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 24 }, removed: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 4, id: 15 }, added: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 4, id: 15 }, options: R, cancellable: S) -> Result<(), Error> {
// unsafe { TODO: call ffi::ostree_diff_dirs_with_options() }
//pub fn diff_dirs_with_options<P: IsA<gio::File>, Q: IsA<gio::File>, R: IsA<gio::Cancellable>>(flags: /*Ignored*/DiffFlags, a: &P, b: &Q, modified: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 24 }, removed: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 4, id: 15 }, added: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 4, id: 15 }, options: /*Ignored*/Option<&mut DiffDirsOptions>, cancellable: Option<&R>) -> Result<(), Error> {
// unsafe { TODO: call ostree_sys:ostree_diff_dirs_with_options() }
//}
//pub fn diff_print<P: IsA<gio::File>, Q: IsA<gio::File>>(a: &P, b: &Q, modified: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 24 }, removed: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 4, id: 15 }, added: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 4, id: 15 }) {
// unsafe { TODO: call ffi::ostree_diff_print() }
// unsafe { TODO: call ostree_sys:ostree_diff_print() }
//}
//#[cfg(any(feature = "v2017_10", feature = "dox"))]
//pub fn gpg_error_quark() -> /*Ignored*/glib::Quark {
// unsafe { TODO: call ffi::ostree_gpg_error_quark() }
// unsafe { TODO: call ostree_sys:ostree_gpg_error_quark() }
//}
//pub fn hash_object_name<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(a: P) -> u32 {
// unsafe { TODO: call ffi::ostree_hash_object_name() }
//pub fn hash_object_name(a: /*Unimplemented*/Option<Fundamental: Pointer>) -> u32 {
// unsafe { TODO: call ostree_sys:ostree_hash_object_name() }
//}
//pub fn metadata_variant_type(objtype: ObjectType) -> /*Ignored*/Option<glib::VariantType> {
// unsafe { TODO: call ffi::ostree_metadata_variant_type() }
// unsafe { TODO: call ostree_sys:ostree_metadata_variant_type() }
//}
pub fn object_from_string(str: &str) -> (String, ObjectType) {
pub fn object_from_string(str: &str) -> (GString, ObjectType) {
unsafe {
let mut out_checksum = ptr::null_mut();
let mut out_objtype = mem::uninitialized();
ffi::ostree_object_from_string(str.to_glib_none().0, &mut out_checksum, &mut out_objtype);
ostree_sys::ostree_object_from_string(str.to_glib_none().0, &mut out_checksum, &mut out_objtype);
(from_glib_full(out_checksum), from_glib(out_objtype))
}
}
pub fn object_name_deserialize(variant: &glib::Variant) -> (String, ObjectType) {
pub fn object_name_deserialize(variant: &glib::Variant) -> (GString, ObjectType) {
unsafe {
let mut out_checksum = ptr::null();
let mut out_objtype = mem::uninitialized();
ffi::ostree_object_name_deserialize(variant.to_glib_none().0, &mut out_checksum, &mut out_objtype);
ostree_sys::ostree_object_name_deserialize(variant.to_glib_none().0, &mut out_checksum, &mut out_objtype);
(from_glib_none(out_checksum), from_glib(out_objtype))
}
}
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.to_glib()))
from_glib_none(ostree_sys::ostree_object_name_serialize(checksum.to_glib_none().0, objtype.to_glib()))
}
}
pub fn object_to_string(checksum: &str, objtype: ObjectType) -> Option<String> {
pub fn object_to_string(checksum: &str, objtype: ObjectType) -> Option<GString> {
unsafe {
from_glib_full(ffi::ostree_object_to_string(checksum.to_glib_none().0, objtype.to_glib()))
from_glib_full(ostree_sys::ostree_object_to_string(checksum.to_glib_none().0, objtype.to_glib()))
}
}
pub fn object_type_from_string(str: &str) -> ObjectType {
unsafe {
from_glib(ffi::ostree_object_type_from_string(str.to_glib_none().0))
from_glib(ostree_sys::ostree_object_type_from_string(str.to_glib_none().0))
}
}
pub fn object_type_to_string(objtype: ObjectType) -> Option<String> {
pub fn object_type_to_string(objtype: ObjectType) -> Option<GString> {
unsafe {
from_glib_none(ffi::ostree_object_type_to_string(objtype.to_glib()))
from_glib_none(ostree_sys::ostree_object_type_to_string(objtype.to_glib()))
}
}
pub fn parse_refspec(refspec: &str) -> Result<(Option<String>, String), Error> {
pub fn parse_refspec(refspec: &str) -> Result<(Option<GString>, GString), Error> {
unsafe {
let mut out_remote = ptr::null_mut();
let mut out_ref = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ffi::ostree_parse_refspec(refspec.to_glib_none().0, &mut out_remote, &mut out_ref, &mut error);
let _ = ostree_sys::ostree_parse_refspec(refspec.to_glib_none().0, &mut out_remote, &mut out_ref, &mut error);
if error.is_null() { Ok((from_glib_full(out_remote), from_glib_full(out_ref))) } else { Err(from_glib_full(error)) }
}
}
#[cfg(any(feature = "v2016_6", feature = "dox"))]
pub fn raw_file_to_archive_z2_stream<'a, 'b, P: IsA<gio::InputStream>, Q: Into<Option<&'a glib::Variant>>, R: Into<Option<&'b gio::Cancellable>>>(input: &P, file_info: &gio::FileInfo, xattrs: Q, cancellable: R) -> Result<gio::InputStream, Error> {
let xattrs = xattrs.into();
let xattrs = xattrs.to_glib_none();
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn raw_file_to_archive_z2_stream<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(input: &P, file_info: &gio::FileInfo, xattrs: Option<&glib::Variant>, cancellable: Option<&Q>) -> Result<gio::InputStream, Error> {
unsafe {
let mut out_input = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ffi::ostree_raw_file_to_archive_z2_stream(input.to_glib_none().0, file_info.to_glib_none().0, xattrs.0, &mut out_input, cancellable.0, &mut error);
let _ = ostree_sys::ostree_raw_file_to_archive_z2_stream(input.as_ref().to_glib_none().0, file_info.to_glib_none().0, xattrs.to_glib_none().0, &mut out_input, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(out_input)) } else { Err(from_glib_full(error)) }
}
}
#[cfg(any(feature = "v2017_3", feature = "dox"))]
pub fn raw_file_to_archive_z2_stream_with_options<'a, 'b, 'c, P: IsA<gio::InputStream>, Q: Into<Option<&'a glib::Variant>>, R: Into<Option<&'b glib::Variant>>, S: Into<Option<&'c gio::Cancellable>>>(input: &P, file_info: &gio::FileInfo, xattrs: Q, options: R, cancellable: S) -> Result<gio::InputStream, Error> {
let xattrs = xattrs.into();
let xattrs = xattrs.to_glib_none();
let options = options.into();
let options = options.to_glib_none();
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn raw_file_to_archive_z2_stream_with_options<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(input: &P, file_info: &gio::FileInfo, xattrs: Option<&glib::Variant>, options: Option<&glib::Variant>, cancellable: Option<&Q>) -> Result<gio::InputStream, Error> {
unsafe {
let mut out_input = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ffi::ostree_raw_file_to_archive_z2_stream_with_options(input.to_glib_none().0, file_info.to_glib_none().0, xattrs.0, options.0, &mut out_input, cancellable.0, &mut error);
let _ = ostree_sys::ostree_raw_file_to_archive_z2_stream_with_options(input.as_ref().to_glib_none().0, file_info.to_glib_none().0, xattrs.to_glib_none().0, options.to_glib_none().0, &mut out_input, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(out_input)) } else { Err(from_glib_full(error)) }
}
}
pub fn raw_file_to_content_stream<'a, 'b, P: IsA<gio::InputStream>, Q: Into<Option<&'a glib::Variant>>, R: Into<Option<&'b gio::Cancellable>>>(input: &P, file_info: &gio::FileInfo, xattrs: Q, cancellable: R) -> Result<(gio::InputStream, u64), Error> {
let xattrs = xattrs.into();
let xattrs = xattrs.to_glib_none();
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn raw_file_to_content_stream<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(input: &P, file_info: &gio::FileInfo, xattrs: Option<&glib::Variant>, cancellable: Option<&Q>) -> Result<(gio::InputStream, u64), Error> {
unsafe {
let mut out_input = ptr::null_mut();
let mut out_length = mem::uninitialized();
let mut error = ptr::null_mut();
let _ = ffi::ostree_raw_file_to_content_stream(input.to_glib_none().0, file_info.to_glib_none().0, xattrs.0, &mut out_input, &mut out_length, cancellable.0, &mut error);
let _ = ostree_sys::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, &mut out_length, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok((from_glib_full(out_input), out_length)) } else { Err(from_glib_full(error)) }
}
}
@ -293,18 +270,16 @@ pub fn raw_file_to_content_stream<'a, 'b, P: IsA<gio::InputStream>, Q: Into<Opti
pub fn validate_checksum_string(sha256: &str) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_validate_checksum_string(sha256.to_glib_none().0, &mut error);
let _ = ostree_sys::ostree_validate_checksum_string(sha256.to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[cfg(any(feature = "v2018_6", feature = "dox"))]
pub fn validate_collection_id<'a, P: Into<Option<&'a str>>>(collection_id: P) -> Result<(), Error> {
let collection_id = collection_id.into();
let collection_id = collection_id.to_glib_none();
pub fn validate_collection_id(collection_id: Option<&str>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_validate_collection_id(collection_id.0, &mut error);
let _ = ostree_sys::ostree_validate_collection_id(collection_id.to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -313,7 +288,7 @@ pub fn validate_collection_id<'a, P: Into<Option<&'a str>>>(collection_id: P) ->
pub fn validate_remote_name(remote_name: &str) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_validate_remote_name(remote_name.to_glib_none().0, &mut error);
let _ = ostree_sys::ostree_validate_remote_name(remote_name.to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -321,7 +296,7 @@ pub fn validate_remote_name(remote_name: &str) -> Result<(), Error> {
pub fn validate_rev(rev: &str) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_validate_rev(rev.to_glib_none().0, &mut error);
let _ = ostree_sys::ostree_validate_rev(rev.to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -329,7 +304,7 @@ pub fn validate_rev(rev: &str) -> Result<(), Error> {
pub fn validate_structureof_checksum_string(checksum: &str) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_validate_structureof_checksum_string(checksum.to_glib_none().0, &mut error);
let _ = ostree_sys::ostree_validate_structureof_checksum_string(checksum.to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -337,7 +312,7 @@ pub fn validate_structureof_checksum_string(checksum: &str) -> Result<(), Error>
pub fn validate_structureof_commit(commit: &glib::Variant) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_validate_structureof_commit(commit.to_glib_none().0, &mut error);
let _ = ostree_sys::ostree_validate_structureof_commit(commit.to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -345,7 +320,7 @@ pub fn validate_structureof_commit(commit: &glib::Variant) -> Result<(), Error>
pub fn validate_structureof_csum_v(checksum: &glib::Variant) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_validate_structureof_csum_v(checksum.to_glib_none().0, &mut error);
let _ = ostree_sys::ostree_validate_structureof_csum_v(checksum.to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -353,7 +328,7 @@ pub fn validate_structureof_csum_v(checksum: &glib::Variant) -> Result<(), Error
pub fn validate_structureof_dirmeta(dirmeta: &glib::Variant) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_validate_structureof_dirmeta(dirmeta.to_glib_none().0, &mut error);
let _ = ostree_sys::ostree_validate_structureof_dirmeta(dirmeta.to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -361,7 +336,7 @@ pub fn validate_structureof_dirmeta(dirmeta: &glib::Variant) -> Result<(), Error
pub fn validate_structureof_dirtree(dirtree: &glib::Variant) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_validate_structureof_dirtree(dirtree.to_glib_none().0, &mut error);
let _ = ostree_sys::ostree_validate_structureof_dirtree(dirtree.to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -369,7 +344,7 @@ pub fn validate_structureof_dirtree(dirtree: &glib::Variant) -> Result<(), Error
pub fn validate_structureof_file_mode(mode: u32) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_validate_structureof_file_mode(mode, &mut error);
let _ = ostree_sys::ostree_validate_structureof_file_mode(mode, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -377,7 +352,7 @@ pub fn validate_structureof_file_mode(mode: u32) -> Result<(), Error> {
pub fn validate_structureof_objtype(objtype: u8) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_validate_structureof_objtype(objtype, &mut error);
let _ = ostree_sys::ostree_validate_structureof_objtype(objtype, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}

View File

@ -5,95 +5,77 @@
#[cfg(any(feature = "v2016_6", feature = "dox"))]
use Error;
use GpgSignatureFormatFlags;
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use ostree_sys;
use std::fmt;
use std::mem;
#[cfg(any(feature = "v2016_6", feature = "dox"))]
use std::ptr;
glib_wrapper! {
pub struct GpgVerifyResult(Object<ffi::OstreeGpgVerifyResult>);
pub struct GpgVerifyResult(Object<ostree_sys::OstreeGpgVerifyResult, GpgVerifyResultClass>);
match fn {
get_type => || ffi::ostree_gpg_verify_result_get_type(),
get_type => || ostree_sys::ostree_gpg_verify_result_get_type(),
}
}
impl GpgVerifyResult {
pub fn describe_variant<'a, P: Into<Option<&'a str>>>(variant: &glib::Variant, output_buffer: &mut glib::String, line_prefix: P, flags: GpgSignatureFormatFlags) {
let line_prefix = line_prefix.into();
let line_prefix = line_prefix.to_glib_none();
pub fn count_all(&self) -> u32 {
unsafe {
ffi::ostree_gpg_verify_result_describe_variant(variant.to_glib_none().0, output_buffer.to_glib_none_mut().0, line_prefix.0, flags.to_glib());
}
}
}
pub trait GpgVerifyResultExt {
fn count_all(&self) -> u32;
fn count_valid(&self) -> u32;
fn describe<'a, P: Into<Option<&'a str>>>(&self, signature_index: u32, output_buffer: &mut glib::String, line_prefix: P, flags: GpgSignatureFormatFlags);
//fn get(&self, signature_index: u32, attrs: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 26 }) -> Option<glib::Variant>;
fn get_all(&self, signature_index: u32) -> Option<glib::Variant>;
fn lookup(&self, key_id: &str) -> Option<u32>;
#[cfg(any(feature = "v2016_6", feature = "dox"))]
fn require_valid_signature(&self) -> Result<(), Error>;
}
impl<O: IsA<GpgVerifyResult>> GpgVerifyResultExt for O {
fn count_all(&self) -> u32 {
unsafe {
ffi::ostree_gpg_verify_result_count_all(self.to_glib_none().0)
ostree_sys::ostree_gpg_verify_result_count_all(self.to_glib_none().0)
}
}
fn count_valid(&self) -> u32 {
pub fn count_valid(&self) -> u32 {
unsafe {
ffi::ostree_gpg_verify_result_count_valid(self.to_glib_none().0)
ostree_sys::ostree_gpg_verify_result_count_valid(self.to_glib_none().0)
}
}
fn describe<'a, P: Into<Option<&'a str>>>(&self, signature_index: u32, output_buffer: &mut glib::String, line_prefix: P, flags: GpgSignatureFormatFlags) {
let line_prefix = line_prefix.into();
let line_prefix = line_prefix.to_glib_none();
pub fn describe(&self, signature_index: u32, output_buffer: &mut glib::String, line_prefix: Option<&str>, flags: GpgSignatureFormatFlags) {
unsafe {
ffi::ostree_gpg_verify_result_describe(self.to_glib_none().0, signature_index, output_buffer.to_glib_none_mut().0, line_prefix.0, flags.to_glib());
ostree_sys::ostree_gpg_verify_result_describe(self.to_glib_none().0, signature_index, output_buffer.to_glib_none_mut().0, line_prefix.to_glib_none().0, flags.to_glib());
}
}
//fn get(&self, signature_index: u32, attrs: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 26 }) -> Option<glib::Variant> {
// unsafe { TODO: call ffi::ostree_gpg_verify_result_get() }
//pub fn get(&self, signature_index: u32, attrs: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 26 }) -> Option<glib::Variant> {
// unsafe { TODO: call ostree_sys:ostree_gpg_verify_result_get() }
//}
fn get_all(&self, signature_index: u32) -> Option<glib::Variant> {
pub fn get_all(&self, signature_index: u32) -> Option<glib::Variant> {
unsafe {
from_glib_full(ffi::ostree_gpg_verify_result_get_all(self.to_glib_none().0, signature_index))
from_glib_full(ostree_sys::ostree_gpg_verify_result_get_all(self.to_glib_none().0, signature_index))
}
}
fn lookup(&self, key_id: &str) -> Option<u32> {
pub fn lookup(&self, key_id: &str) -> Option<u32> {
unsafe {
let mut out_signature_index = mem::uninitialized();
let ret = from_glib(ffi::ostree_gpg_verify_result_lookup(self.to_glib_none().0, key_id.to_glib_none().0, &mut out_signature_index));
let ret = from_glib(ostree_sys::ostree_gpg_verify_result_lookup(self.to_glib_none().0, key_id.to_glib_none().0, &mut out_signature_index));
if ret { Some(out_signature_index) } else { None }
}
}
#[cfg(any(feature = "v2016_6", feature = "dox"))]
fn require_valid_signature(&self) -> Result<(), Error> {
pub fn require_valid_signature(&self) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_gpg_verify_result_require_valid_signature(self.to_glib_none().0, &mut error);
let _ = ostree_sys::ostree_gpg_verify_result_require_valid_signature(self.to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
pub fn describe_variant(variant: &glib::Variant, output_buffer: &mut glib::String, line_prefix: Option<&str>, flags: GpgSignatureFormatFlags) {
unsafe {
ostree_sys::ostree_gpg_verify_result_describe_variant(variant.to_glib_none().0, output_buffer.to_glib_none_mut().0, line_prefix.to_glib_none().0, flags.to_glib());
}
}
}
impl fmt::Display for GpgVerifyResult {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "GpgVerifyResult")
}
}

View File

@ -3,44 +3,37 @@
// DO NOT EDIT
mod async_progress;
pub use self::async_progress::AsyncProgress;
pub use self::async_progress::{AsyncProgress, AsyncProgressClass, NONE_ASYNC_PROGRESS};
pub use self::async_progress::AsyncProgressExt;
mod bootconfig_parser;
pub use self::bootconfig_parser::BootconfigParser;
pub use self::bootconfig_parser::BootconfigParserExt;
pub use self::bootconfig_parser::{BootconfigParser, BootconfigParserClass};
mod deployment;
pub use self::deployment::Deployment;
pub use self::deployment::DeploymentExt;
pub use self::deployment::{Deployment, DeploymentClass};
mod gpg_verify_result;
pub use self::gpg_verify_result::GpgVerifyResult;
pub use self::gpg_verify_result::GpgVerifyResultExt;
pub use self::gpg_verify_result::{GpgVerifyResult, GpgVerifyResultClass};
mod mutable_tree;
pub use self::mutable_tree::MutableTree;
pub use self::mutable_tree::{MutableTree, MutableTreeClass, NONE_MUTABLE_TREE};
pub use self::mutable_tree::MutableTreeExt;
mod repo;
pub use self::repo::Repo;
pub use self::repo::RepoExt;
pub use self::repo::{Repo, RepoClass};
mod repo_file;
pub use self::repo_file::RepoFile;
pub use self::repo_file::{RepoFile, RepoFileClass, NONE_REPO_FILE};
pub use self::repo_file::RepoFileExt;
mod se_policy;
pub use self::se_policy::SePolicy;
pub use self::se_policy::SePolicyExt;
pub use self::se_policy::{SePolicy, SePolicyClass};
mod sysroot;
pub use self::sysroot::Sysroot;
pub use self::sysroot::SysrootExt;
pub use self::sysroot::{Sysroot, SysrootClass};
mod sysroot_upgrader;
pub use self::sysroot_upgrader::SysrootUpgrader;
pub use self::sysroot_upgrader::SysrootUpgraderExt;
pub use self::sysroot_upgrader::{SysrootUpgrader, SysrootUpgraderClass};
#[cfg(any(feature = "v2018_6", feature = "dox"))]
mod remote;
@ -109,13 +102,6 @@ pub use self::constants::TREE_GVARIANT_STRING;
#[doc(hidden)]
pub mod traits {
pub use super::AsyncProgressExt;
pub use super::BootconfigParserExt;
pub use super::DeploymentExt;
pub use super::GpgVerifyResultExt;
pub use super::MutableTreeExt;
pub use super::RepoExt;
pub use super::RepoFileExt;
pub use super::SePolicyExt;
pub use super::SysrootExt;
pub use super::SysrootUpgraderExt;
}

View File

@ -5,33 +5,32 @@
use Error;
#[cfg(any(feature = "v2018_7", feature = "dox"))]
use Repo;
use ffi;
use glib::GString;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use ostree_sys;
use std::fmt;
use std::ptr;
glib_wrapper! {
pub struct MutableTree(Object<ffi::OstreeMutableTree, ffi::OstreeMutableTreeClass>);
pub struct MutableTree(Object<ostree_sys::OstreeMutableTree, ostree_sys::OstreeMutableTreeClass, MutableTreeClass>);
match fn {
get_type => || ffi::ostree_mutable_tree_get_type(),
get_type => || ostree_sys::ostree_mutable_tree_get_type(),
}
}
impl MutableTree {
pub fn new() -> MutableTree {
unsafe {
from_glib_full(ffi::ostree_mutable_tree_new())
from_glib_full(ostree_sys::ostree_mutable_tree_new())
}
}
#[cfg(any(feature = "v2018_7", feature = "dox"))]
pub fn new_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(ostree_sys::ostree_mutable_tree_new_from_checksum(repo.to_glib_none().0, contents_checksum.to_glib_none().0, metadata_checksum.to_glib_none().0))
}
}
}
@ -42,7 +41,9 @@ impl Default for MutableTree {
}
}
pub trait MutableTreeExt {
pub const NONE_MUTABLE_TREE: Option<&MutableTree> = None;
pub trait MutableTreeExt: 'static {
#[cfg(any(feature = "v2018_7", feature = "dox"))]
fn check_error(&self) -> Result<(), Error>;
@ -53,15 +54,15 @@ pub trait MutableTreeExt {
#[cfg(any(feature = "v2018_7", feature = "dox"))]
fn fill_empty_from_dirtree(&self, repo: &Repo, contents_checksum: &str, metadata_checksum: &str) -> bool;
fn get_contents_checksum(&self) -> Option<String>;
fn get_contents_checksum(&self) -> Option<GString>;
//fn get_files(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 };
fn get_metadata_checksum(&self) -> Option<String>;
fn get_metadata_checksum(&self) -> Option<GString>;
//fn get_subdirs(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 1, id: 37 };
fn lookup(&self, name: &str) -> Result<(String, MutableTree), Error>;
fn lookup(&self, name: &str) -> Result<(GString, MutableTree), Error>;
#[cfg(any(feature = "v2018_9", feature = "dox"))]
fn remove(&self, name: &str, allow_noent: bool) -> Result<(), Error>;
@ -80,7 +81,7 @@ impl<O: IsA<MutableTree>> MutableTreeExt for O {
fn check_error(&self) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_mutable_tree_check_error(self.to_glib_none().0, &mut error);
let _ = ostree_sys::ostree_mutable_tree_check_error(self.as_ref().to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -89,48 +90,48 @@ impl<O: IsA<MutableTree>> MutableTreeExt for O {
unsafe {
let mut out_subdir = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ffi::ostree_mutable_tree_ensure_dir(self.to_glib_none().0, name.to_glib_none().0, &mut out_subdir, &mut error);
let _ = ostree_sys::ostree_mutable_tree_ensure_dir(self.as_ref().to_glib_none().0, name.to_glib_none().0, &mut out_subdir, &mut error);
if error.is_null() { Ok(from_glib_full(out_subdir)) } else { Err(from_glib_full(error)) }
}
}
//fn ensure_parent_dirs(&self, split_path: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 0, id: 28 }, metadata_checksum: &str) -> Result<MutableTree, Error> {
// unsafe { TODO: call ffi::ostree_mutable_tree_ensure_parent_dirs() }
// unsafe { TODO: call ostree_sys:ostree_mutable_tree_ensure_parent_dirs() }
//}
#[cfg(any(feature = "v2018_7", feature = "dox"))]
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(ostree_sys::ostree_mutable_tree_fill_empty_from_dirtree(self.as_ref().to_glib_none().0, repo.to_glib_none().0, contents_checksum.to_glib_none().0, metadata_checksum.to_glib_none().0))
}
}
fn get_contents_checksum(&self) -> Option<String> {
fn get_contents_checksum(&self) -> Option<GString> {
unsafe {
from_glib_none(ffi::ostree_mutable_tree_get_contents_checksum(self.to_glib_none().0))
from_glib_none(ostree_sys::ostree_mutable_tree_get_contents_checksum(self.as_ref().to_glib_none().0))
}
}
//fn get_files(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } {
// unsafe { TODO: call ffi::ostree_mutable_tree_get_files() }
// unsafe { TODO: call ostree_sys:ostree_mutable_tree_get_files() }
//}
fn get_metadata_checksum(&self) -> Option<String> {
fn get_metadata_checksum(&self) -> Option<GString> {
unsafe {
from_glib_none(ffi::ostree_mutable_tree_get_metadata_checksum(self.to_glib_none().0))
from_glib_none(ostree_sys::ostree_mutable_tree_get_metadata_checksum(self.as_ref().to_glib_none().0))
}
}
//fn get_subdirs(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 1, id: 37 } {
// unsafe { TODO: call ffi::ostree_mutable_tree_get_subdirs() }
// unsafe { TODO: call ostree_sys:ostree_mutable_tree_get_subdirs() }
//}
fn lookup(&self, name: &str) -> Result<(String, MutableTree), Error> {
fn lookup(&self, name: &str) -> Result<(GString, MutableTree), Error> {
unsafe {
let mut out_file_checksum = ptr::null_mut();
let mut out_subdir = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ffi::ostree_mutable_tree_lookup(self.to_glib_none().0, name.to_glib_none().0, &mut out_file_checksum, &mut out_subdir, &mut error);
let _ = ostree_sys::ostree_mutable_tree_lookup(self.as_ref().to_glib_none().0, name.to_glib_none().0, &mut out_file_checksum, &mut out_subdir, &mut error);
if error.is_null() { Ok((from_glib_full(out_file_checksum), from_glib_full(out_subdir))) } else { Err(from_glib_full(error)) }
}
}
@ -139,7 +140,7 @@ impl<O: IsA<MutableTree>> MutableTreeExt for O {
fn remove(&self, name: &str, allow_noent: bool) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_mutable_tree_remove(self.to_glib_none().0, name.to_glib_none().0, allow_noent.to_glib(), &mut error);
let _ = ostree_sys::ostree_mutable_tree_remove(self.as_ref().to_glib_none().0, name.to_glib_none().0, allow_noent.to_glib(), &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@ -147,24 +148,30 @@ impl<O: IsA<MutableTree>> MutableTreeExt for O {
fn replace_file(&self, name: &str, checksum: &str) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_mutable_tree_replace_file(self.to_glib_none().0, name.to_glib_none().0, checksum.to_glib_none().0, &mut error);
let _ = ostree_sys::ostree_mutable_tree_replace_file(self.as_ref().to_glib_none().0, name.to_glib_none().0, checksum.to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
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);
ostree_sys::ostree_mutable_tree_set_contents_checksum(self.as_ref().to_glib_none().0, checksum.to_glib_none().0);
}
}
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);
ostree_sys::ostree_mutable_tree_set_metadata_checksum(self.as_ref().to_glib_none().0, checksum.to_glib_none().0);
}
}
//fn walk(&self, split_path: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 0, id: 28 }, start: u32) -> Result<MutableTree, Error> {
// unsafe { TODO: call ffi::ostree_mutable_tree_walk() }
// unsafe { TODO: call ostree_sys:ostree_mutable_tree_walk() }
//}
}
impl fmt::Display for MutableTree {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "MutableTree")
}
}

View File

@ -2,36 +2,35 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use ffi;
#[cfg(any(feature = "v2018_6", feature = "dox"))]
use glib::GString;
#[cfg(any(feature = "v2018_6", feature = "dox"))]
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
use ostree_sys;
glib_wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Remote(Shared<ffi::OstreeRemote>);
pub struct Remote(Shared<ostree_sys::OstreeRemote>);
match fn {
ref => |ptr| ffi::ostree_remote_ref(ptr),
unref => |ptr| ffi::ostree_remote_unref(ptr),
get_type => || ffi::ostree_remote_get_type(),
ref => |ptr| ostree_sys::ostree_remote_ref(ptr),
unref => |ptr| ostree_sys::ostree_remote_unref(ptr),
get_type => || ostree_sys::ostree_remote_get_type(),
}
}
impl Remote {
#[cfg(any(feature = "v2018_6", feature = "dox"))]
pub fn get_name(&self) -> Option<String> {
pub fn get_name(&self) -> Option<GString> {
unsafe {
from_glib_none(ffi::ostree_remote_get_name(self.to_glib_none().0))
from_glib_none(ostree_sys::ostree_remote_get_name(self.to_glib_none().0))
}
}
#[cfg(any(feature = "v2018_6", feature = "dox"))]
pub fn get_url(&self) -> Option<String> {
pub fn get_url(&self) -> Option<GString> {
unsafe {
from_glib_full(ffi::ostree_remote_get_url(self.to_glib_none().0))
from_glib_full(ostree_sys::ostree_remote_get_url(self.to_glib_none().0))
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -2,48 +2,64 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use Repo;
#[cfg(any(feature = "v2017_13", feature = "dox"))]
use RepoDevInoCache;
use SePolicy;
use ffi;
use gio;
use glib;
use glib::GString;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
use ostree_sys;
use std::boxed::Box as Box_;
glib_wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct RepoCommitModifier(Shared<ffi::OstreeRepoCommitModifier>);
pub struct RepoCommitModifier(Shared<ostree_sys::OstreeRepoCommitModifier>);
match fn {
ref => |ptr| ffi::ostree_repo_commit_modifier_ref(ptr),
unref => |ptr| ffi::ostree_repo_commit_modifier_unref(ptr),
get_type => || ffi::ostree_repo_commit_modifier_get_type(),
ref => |ptr| ostree_sys::ostree_repo_commit_modifier_ref(ptr),
unref => |ptr| ostree_sys::ostree_repo_commit_modifier_unref(ptr),
get_type => || ostree_sys::ostree_repo_commit_modifier_get_type(),
}
}
impl RepoCommitModifier {
//pub fn new<'a, P: Into<Option<&'a /*Unimplemented*/RepoCommitFilter>>>(flags: /*Ignored*/RepoCommitModifierFlags, commit_filter: P, destroy_notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) -> RepoCommitModifier {
// unsafe { TODO: call ffi::ostree_repo_commit_modifier_new() }
//pub fn new(flags: /*Ignored*/RepoCommitModifierFlags, commit_filter: /*Unimplemented*/Fn(&Repo, &str, &gio::FileInfo) -> /*Ignored*/RepoCommitFilterResult, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> RepoCommitModifier {
// unsafe { TODO: call ostree_sys:ostree_repo_commit_modifier_new() }
//}
#[cfg(any(feature = "v2017_13", feature = "dox"))]
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);
ostree_sys::ostree_repo_commit_modifier_set_devino_cache(self.to_glib_none().0, cache.to_glib_none().0);
}
}
pub fn set_sepolicy<'a, P: Into<Option<&'a SePolicy>>>(&self, sepolicy: P) {
let sepolicy = sepolicy.into();
let sepolicy = sepolicy.to_glib_none();
pub fn set_sepolicy(&self, sepolicy: Option<&SePolicy>) {
unsafe {
ffi::ostree_repo_commit_modifier_set_sepolicy(self.to_glib_none().0, sepolicy.0);
ostree_sys::ostree_repo_commit_modifier_set_sepolicy(self.to_glib_none().0, sepolicy.to_glib_none().0);
}
}
//pub fn set_xattr_callback(&self, callback: /*Unknown conversion*//*Unimplemented*/RepoCommitModifierXattrCallback, destroy: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
// unsafe { TODO: call ffi::ostree_repo_commit_modifier_set_xattr_callback() }
//}
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 ostree_sys::OstreeRepo, path: *const libc::c_char, file_info: *mut gio_sys::GFileInfo, user_data: glib_sys::gpointer) -> *mut glib_sys::GVariant {
let repo = from_glib_borrow(repo);
let path: GString = from_glib_borrow(path);
let file_info = from_glib_borrow(file_info);
let callback: &P = &*(user_data as *mut _);
let res = (*callback)(&repo, path.as_str(), &file_info);
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_sys::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 {
ostree_sys::ostree_repo_commit_modifier_set_xattr_callback(self.to_glib_none().0, callback, destroy_call2, Box::into_raw(super_callback0) as *mut _);
}
}
}

View File

@ -2,28 +2,24 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use ffi;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
use ostree_sys;
glib_wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct RepoDevInoCache(Shared<ffi::OstreeRepoDevInoCache>);
pub struct RepoDevInoCache(Shared<ostree_sys::OstreeRepoDevInoCache>);
match fn {
ref => |ptr| ffi::ostree_repo_devino_cache_ref(ptr),
unref => |ptr| ffi::ostree_repo_devino_cache_unref(ptr),
get_type => || ffi::ostree_repo_devino_cache_get_type(),
ref => |ptr| ostree_sys::ostree_repo_devino_cache_ref(ptr),
unref => |ptr| ostree_sys::ostree_repo_devino_cache_unref(ptr),
get_type => || ostree_sys::ostree_repo_devino_cache_get_type(),
}
}
impl RepoDevInoCache {
pub fn new() -> RepoDevInoCache {
unsafe {
from_glib_full(ffi::ostree_repo_devino_cache_new())
from_glib_full(ostree_sys::ostree_repo_devino_cache_new())
}
}
}

View File

@ -4,49 +4,48 @@
use Error;
use Repo;
use ffi;
use gio;
use gio_ffi;
use glib;
use glib::GString;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use ostree_sys;
use std::fmt;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct RepoFile(Object<ffi::OstreeRepoFile, ffi::OstreeRepoFileClass>): [
gio::File => gio_ffi::GFile,
];
pub struct RepoFile(Object<ostree_sys::OstreeRepoFile, ostree_sys::OstreeRepoFileClass, RepoFileClass>) @implements gio::File;
match fn {
get_type => || ffi::ostree_repo_file_get_type(),
get_type => || ostree_sys::ostree_repo_file_get_type(),
}
}
pub trait RepoFileExt {
pub const NONE_REPO_FILE: Option<&RepoFile> = None;
pub trait RepoFileExt: 'static {
fn ensure_resolved(&self) -> Result<(), Error>;
fn get_checksum(&self) -> Option<String>;
fn get_checksum(&self) -> Option<GString>;
fn get_repo(&self) -> Option<Repo>;
fn get_root(&self) -> Option<RepoFile>;
fn get_xattrs<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<glib::Variant, Error>;
fn get_xattrs<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<glib::Variant, Error>;
fn tree_find_child(&self, name: &str) -> (i32, bool, glib::Variant);
fn tree_get_contents(&self) -> Option<glib::Variant>;
fn tree_get_contents_checksum(&self) -> Option<String>;
fn tree_get_contents_checksum(&self) -> Option<GString>;
fn tree_get_metadata(&self) -> Option<glib::Variant>;
fn tree_get_metadata_checksum(&self) -> Option<String>;
fn tree_get_metadata_checksum(&self) -> Option<GString>;
fn tree_query_child<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, n: i32, attributes: &str, flags: gio::FileQueryInfoFlags, cancellable: P) -> Result<gio::FileInfo, Error>;
fn tree_query_child<P: IsA<gio::Cancellable>>(&self, n: i32, attributes: &str, flags: gio::FileQueryInfoFlags, cancellable: Option<&P>) -> Result<gio::FileInfo, Error>;
fn tree_set_metadata(&self, checksum: &str, metadata: &glib::Variant);
}
@ -55,36 +54,34 @@ impl<O: IsA<RepoFile>> RepoFileExt for O {
fn ensure_resolved(&self) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_repo_file_ensure_resolved(self.to_glib_none().0, &mut error);
let _ = ostree_sys::ostree_repo_file_ensure_resolved(self.as_ref().to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
fn get_checksum(&self) -> Option<String> {
fn get_checksum(&self) -> Option<GString> {
unsafe {
from_glib_none(ffi::ostree_repo_file_get_checksum(self.to_glib_none().0))
from_glib_none(ostree_sys::ostree_repo_file_get_checksum(self.as_ref().to_glib_none().0))
}
}
fn get_repo(&self) -> Option<Repo> {
unsafe {
from_glib_none(ffi::ostree_repo_file_get_repo(self.to_glib_none().0))
from_glib_none(ostree_sys::ostree_repo_file_get_repo(self.as_ref().to_glib_none().0))
}
}
fn get_root(&self) -> Option<RepoFile> {
unsafe {
from_glib_none(ffi::ostree_repo_file_get_root(self.to_glib_none().0))
from_glib_none(ostree_sys::ostree_repo_file_get_root(self.as_ref().to_glib_none().0))
}
}
fn get_xattrs<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<glib::Variant, Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
fn get_xattrs<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<glib::Variant, Error> {
unsafe {
let mut out_xattrs = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ffi::ostree_repo_file_get_xattrs(self.to_glib_none().0, &mut out_xattrs, cancellable.0, &mut error);
let _ = ostree_sys::ostree_repo_file_get_xattrs(self.as_ref().to_glib_none().0, &mut out_xattrs, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(out_xattrs)) } else { Err(from_glib_full(error)) }
}
}
@ -93,49 +90,53 @@ impl<O: IsA<RepoFile>> RepoFileExt for O {
unsafe {
let mut is_dir = mem::uninitialized();
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, &mut is_dir, &mut out_container);
let ret = ostree_sys::ostree_repo_file_tree_find_child(self.as_ref().to_glib_none().0, name.to_glib_none().0, &mut is_dir, &mut out_container);
(ret, from_glib(is_dir), from_glib_full(out_container))
}
}
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(ostree_sys::ostree_repo_file_tree_get_contents(self.as_ref().to_glib_none().0))
}
}
fn tree_get_contents_checksum(&self) -> Option<String> {
fn tree_get_contents_checksum(&self) -> Option<GString> {
unsafe {
from_glib_none(ffi::ostree_repo_file_tree_get_contents_checksum(self.to_glib_none().0))
from_glib_none(ostree_sys::ostree_repo_file_tree_get_contents_checksum(self.as_ref().to_glib_none().0))
}
}
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(ostree_sys::ostree_repo_file_tree_get_metadata(self.as_ref().to_glib_none().0))
}
}
fn tree_get_metadata_checksum(&self) -> Option<String> {
fn tree_get_metadata_checksum(&self) -> Option<GString> {
unsafe {
from_glib_none(ffi::ostree_repo_file_tree_get_metadata_checksum(self.to_glib_none().0))
from_glib_none(ostree_sys::ostree_repo_file_tree_get_metadata_checksum(self.as_ref().to_glib_none().0))
}
}
fn tree_query_child<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, n: i32, attributes: &str, flags: gio::FileQueryInfoFlags, cancellable: P) -> Result<gio::FileInfo, Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
fn tree_query_child<P: IsA<gio::Cancellable>>(&self, n: i32, attributes: &str, flags: gio::FileQueryInfoFlags, cancellable: Option<&P>) -> Result<gio::FileInfo, Error> {
unsafe {
let mut out_info = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ffi::ostree_repo_file_tree_query_child(self.to_glib_none().0, n, attributes.to_glib_none().0, flags.to_glib(), &mut out_info, cancellable.0, &mut error);
let _ = ostree_sys::ostree_repo_file_tree_query_child(self.as_ref().to_glib_none().0, n, attributes.to_glib_none().0, flags.to_glib(), &mut out_info, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(out_info)) } else { Err(from_glib_full(error)) }
}
}
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);
ostree_sys::ostree_repo_file_tree_set_metadata(self.as_ref().to_glib_none().0, checksum.to_glib_none().0, metadata.to_glib_none().0);
}
}
}
impl fmt::Display for RepoFile {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "RepoFile")
}
}

View File

@ -2,20 +2,16 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use ffi;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
use gobject_sys;
use ostree_sys;
glib_wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct RepoTransactionStats(Boxed<ffi::OstreeRepoTransactionStats>);
pub struct RepoTransactionStats(Boxed<ostree_sys::OstreeRepoTransactionStats>);
match fn {
copy => |ptr| gobject_ffi::g_boxed_copy(ffi::ostree_repo_transaction_stats_get_type(), ptr as *mut _) as *mut ffi::OstreeRepoTransactionStats,
free => |ptr| gobject_ffi::g_boxed_free(ffi::ostree_repo_transaction_stats_get_type(), ptr as *mut _),
get_type => || ffi::ostree_repo_transaction_stats_get_type(),
copy => |ptr| gobject_sys::g_boxed_copy(ostree_sys::ostree_repo_transaction_stats_get_type(), ptr as *mut _) as *mut ostree_sys::OstreeRepoTransactionStats,
free => |ptr| gobject_sys::g_boxed_free(ostree_sys::ostree_repo_transaction_stats_get_type(), ptr as *mut _),
get_type => || ostree_sys::ostree_repo_transaction_stats_get_type(),
}
}

View File

@ -4,127 +4,104 @@
use Error;
use SePolicyRestoreconFlags;
use ffi;
use gio;
use glib;
use glib::GString;
use glib::StaticType;
use glib::Value;
use glib::object::IsA;
use glib::object::ObjectType as _;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use gobject_sys;
use ostree_sys;
use std::fmt;
use std::ptr;
glib_wrapper! {
pub struct SePolicy(Object<ffi::OstreeSePolicy>);
pub struct SePolicy(Object<ostree_sys::OstreeSePolicy, SePolicyClass>);
match fn {
get_type => || ffi::ostree_sepolicy_get_type(),
get_type => || ostree_sys::ostree_sepolicy_get_type(),
}
}
impl SePolicy {
pub fn new<'a, P: IsA<gio::File>, Q: Into<Option<&'a gio::Cancellable>>>(path: &P, cancellable: Q) -> Result<SePolicy, Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn new<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(path: &P, cancellable: Option<&Q>) -> Result<SePolicy, Error> {
unsafe {
let mut error = ptr::null_mut();
let ret = ffi::ostree_sepolicy_new(path.to_glib_none().0, cancellable.0, &mut error);
let ret = ostree_sys::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"))]
pub fn new_at<'a, P: Into<Option<&'a gio::Cancellable>>>(rootfs_dfd: i32, cancellable: P) -> Result<SePolicy, Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn new_at<P: IsA<gio::Cancellable>>(rootfs_dfd: i32, cancellable: Option<&P>) -> Result<SePolicy, Error> {
unsafe {
let mut error = ptr::null_mut();
let ret = ffi::ostree_sepolicy_new_at(rootfs_dfd, cancellable.0, &mut error);
let ret = ostree_sys::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)) }
}
}
//pub fn fscreatecon_cleanup<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(unused: P) {
// unsafe { TODO: call ffi::ostree_sepolicy_fscreatecon_cleanup() }
//}
}
pub trait SePolicyExt {
#[cfg(any(feature = "v2016_5", feature = "dox"))]
fn get_csum(&self) -> Option<String>;
fn get_label<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, relpath: &str, unix_mode: u32, cancellable: P) -> Result<String, Error>;
fn get_name(&self) -> Option<String>;
fn get_path(&self) -> Option<gio::File>;
fn restorecon<'a, 'b, P: Into<Option<&'a gio::FileInfo>>, Q: IsA<gio::File>, R: Into<Option<&'b gio::Cancellable>>>(&self, path: &str, info: P, target: &Q, flags: SePolicyRestoreconFlags, cancellable: R) -> Result<String, Error>;
fn setfscreatecon(&self, path: &str, mode: u32) -> Result<(), Error>;
fn get_property_rootfs_dfd(&self) -> i32;
}
impl<O: IsA<SePolicy> + IsA<glib::object::Object>> SePolicyExt for O {
#[cfg(any(feature = "v2016_5", feature = "dox"))]
fn get_csum(&self) -> Option<String> {
pub fn get_csum(&self) -> Option<GString> {
unsafe {
from_glib_none(ffi::ostree_sepolicy_get_csum(self.to_glib_none().0))
from_glib_none(ostree_sys::ostree_sepolicy_get_csum(self.to_glib_none().0))
}
}
fn get_label<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, relpath: &str, unix_mode: u32, cancellable: P) -> Result<String, Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn get_label<P: IsA<gio::Cancellable>>(&self, relpath: &str, unix_mode: u32, cancellable: Option<&P>) -> Result<GString, Error> {
unsafe {
let mut out_label = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ffi::ostree_sepolicy_get_label(self.to_glib_none().0, relpath.to_glib_none().0, unix_mode, &mut out_label, cancellable.0, &mut error);
let _ = ostree_sys::ostree_sepolicy_get_label(self.to_glib_none().0, relpath.to_glib_none().0, unix_mode, &mut out_label, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(out_label)) } else { Err(from_glib_full(error)) }
}
}
fn get_name(&self) -> Option<String> {
pub fn get_name(&self) -> Option<GString> {
unsafe {
from_glib_none(ffi::ostree_sepolicy_get_name(self.to_glib_none().0))
from_glib_none(ostree_sys::ostree_sepolicy_get_name(self.to_glib_none().0))
}
}
fn get_path(&self) -> Option<gio::File> {
pub fn get_path(&self) -> Option<gio::File> {
unsafe {
from_glib_none(ffi::ostree_sepolicy_get_path(self.to_glib_none().0))
from_glib_none(ostree_sys::ostree_sepolicy_get_path(self.to_glib_none().0))
}
}
fn restorecon<'a, 'b, P: Into<Option<&'a gio::FileInfo>>, Q: IsA<gio::File>, R: Into<Option<&'b gio::Cancellable>>>(&self, path: &str, info: P, target: &Q, flags: SePolicyRestoreconFlags, cancellable: R) -> Result<String, Error> {
let info = info.into();
let info = info.to_glib_none();
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn restorecon<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(&self, path: &str, info: Option<&gio::FileInfo>, target: &P, flags: SePolicyRestoreconFlags, cancellable: Option<&Q>) -> Result<GString, Error> {
unsafe {
let mut out_new_label = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ffi::ostree_sepolicy_restorecon(self.to_glib_none().0, path.to_glib_none().0, info.0, target.to_glib_none().0, flags.to_glib(), &mut out_new_label, cancellable.0, &mut error);
let _ = ostree_sys::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.to_glib(), &mut out_new_label, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(out_new_label)) } else { Err(from_glib_full(error)) }
}
}
fn setfscreatecon(&self, path: &str, mode: u32) -> Result<(), Error> {
pub fn setfscreatecon(&self, path: &str, mode: u32) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sepolicy_setfscreatecon(self.to_glib_none().0, path.to_glib_none().0, mode, &mut error);
let _ = ostree_sys::ostree_sepolicy_setfscreatecon(self.to_glib_none().0, path.to_glib_none().0, mode, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
fn get_property_rootfs_dfd(&self) -> i32 {
pub fn get_property_rootfs_dfd(&self) -> i32 {
unsafe {
let mut value = Value::from_type(<i32 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "rootfs-dfd".to_glib_none().0, value.to_glib_none_mut().0);
gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"rootfs-dfd\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
//pub fn fscreatecon_cleanup(unused: /*Unimplemented*/Option<Fundamental: Pointer>) {
// unsafe { TODO: call ostree_sys:ostree_sepolicy_fscreatecon_cleanup() }
//}
}
impl fmt::Display for SePolicy {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "SePolicy")
}
}

View File

@ -8,508 +8,365 @@ use DeploymentUnlockedState;
use Error;
use Repo;
use SysrootSimpleWriteDeploymentFlags;
use ffi;
#[cfg(feature = "futures")]
use futures_core;
use futures::future;
use gio;
use gio_ffi;
use gio_sys;
use glib;
#[cfg(any(feature = "v2017_10", feature = "dox"))]
use glib::object::Downcast;
use glib::GString;
use glib::object::IsA;
#[cfg(any(feature = "v2017_10", feature = "dox"))]
use glib::object::ObjectType as _;
#[cfg(any(feature = "v2017_10", feature = "dox"))]
use glib::signal::SignalHandlerId;
#[cfg(any(feature = "v2017_10", feature = "dox"))]
use glib::signal::connect;
use glib::signal::connect_raw;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use glib_sys;
use gobject_sys;
#[cfg(any(feature = "v2017_10", feature = "dox"))]
use libc;
use ostree_sys;
use std::boxed::Box as Box_;
use std::fmt;
use std::mem;
#[cfg(any(feature = "v2017_10", feature = "dox"))]
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct Sysroot(Object<ffi::OstreeSysroot>);
pub struct Sysroot(Object<ostree_sys::OstreeSysroot, SysrootClass>);
match fn {
get_type => || ffi::ostree_sysroot_get_type(),
get_type => || ostree_sys::ostree_sysroot_get_type(),
}
}
impl Sysroot {
pub fn new<'a, P: IsA<gio::File> + 'a, Q: Into<Option<&'a P>>>(path: Q) -> Sysroot {
let path = path.into();
let path = path.to_glib_none();
pub fn new<P: IsA<gio::File>>(path: Option<&P>) -> Sysroot {
unsafe {
from_glib_full(ffi::ostree_sysroot_new(path.0))
from_glib_full(ostree_sys::ostree_sysroot_new(path.map(|p| p.as_ref()).to_glib_none().0))
}
}
pub fn new_default() -> Sysroot {
unsafe {
from_glib_full(ffi::ostree_sysroot_new_default())
from_glib_full(ostree_sys::ostree_sysroot_new_default())
}
}
pub fn get_deployment_origin_path<P: IsA<gio::File>>(deployment_path: &P) -> Option<gio::File> {
unsafe {
from_glib_full(ffi::ostree_sysroot_get_deployment_origin_path(deployment_path.to_glib_none().0))
}
}
}
pub trait SysrootExt: Sized {
fn cleanup<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<(), Error>;
//#[cfg(any(feature = "v2018_6", feature = "dox"))]
//fn cleanup_prune_repo<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, options: /*Ignored*/&mut RepoPruneOptions, cancellable: P) -> Result<(i32, i32, u64), Error>;
fn deploy_tree<'a, 'b, 'c, 'd, P: Into<Option<&'a str>>, Q: Into<Option<&'b glib::KeyFile>>, R: Into<Option<&'c Deployment>>, S: Into<Option<&'d gio::Cancellable>>>(&self, osname: P, revision: &str, origin: Q, provided_merge_deployment: R, override_kernel_argv: &[&str], cancellable: S) -> Result<Deployment, Error>;
fn deployment_set_kargs<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, deployment: &Deployment, new_kargs: &[&str], cancellable: P) -> Result<(), Error>;
fn deployment_set_mutable<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, deployment: &Deployment, is_mutable: bool, cancellable: P) -> Result<(), Error>;
#[cfg(any(feature = "v2018_3", feature = "dox"))]
fn deployment_set_pinned(&self, deployment: &Deployment, is_pinned: bool) -> Result<(), Error>;
#[cfg(any(feature = "v2016_4", feature = "dox"))]
fn deployment_unlock<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, deployment: &Deployment, unlocked_state: DeploymentUnlockedState, cancellable: P) -> Result<(), Error>;
fn ensure_initialized<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<(), Error>;
fn get_booted_deployment(&self) -> Option<Deployment>;
fn get_bootversion(&self) -> i32;
fn get_deployment_directory(&self, deployment: &Deployment) -> Option<gio::File>;
fn get_deployment_dirpath(&self, deployment: &Deployment) -> Option<String>;
//fn get_deployments(&self) -> /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 19 };
fn get_fd(&self) -> i32;
fn get_merge_deployment<'a, P: Into<Option<&'a str>>>(&self, osname: P) -> Option<Deployment>;
fn get_path(&self) -> Option<gio::File>;
fn get_repo<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<Repo, Error>;
#[cfg(any(feature = "v2018_5", feature = "dox"))]
fn get_staged_deployment(&self) -> Option<Deployment>;
fn get_subbootversion(&self) -> i32;
#[cfg(any(feature = "v2016_4", feature = "dox"))]
fn init_osname<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, osname: &str, cancellable: P) -> Result<(), Error>;
fn load<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<(), Error>;
#[cfg(any(feature = "v2016_4", feature = "dox"))]
fn load_if_changed<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<bool, Error>;
fn lock(&self) -> Result<(), Error>;
fn lock_async<'a, P: Into<Option<&'a gio::Cancellable>>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cancellable: P, callback: Q);
#[cfg(feature = "futures")]
fn lock_async_future(&self) -> Box_<futures_core::Future<Item = (Self, ()), Error = (Self, Error)>>;
fn origin_new_from_refspec(&self, refspec: &str) -> Option<glib::KeyFile>;
fn prepare_cleanup<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<(), Error>;
#[cfg(any(feature = "v2017_7", feature = "dox"))]
fn query_deployments_for<'a, P: Into<Option<&'a str>>>(&self, osname: P) -> (Deployment, Deployment);
#[cfg(any(feature = "v2017_7", feature = "dox"))]
fn repo(&self) -> Option<Repo>;
fn simple_write_deployment<'a, 'b, 'c, P: Into<Option<&'a str>>, Q: Into<Option<&'b Deployment>>, R: Into<Option<&'c gio::Cancellable>>>(&self, osname: P, new_deployment: &Deployment, merge_deployment: Q, flags: SysrootSimpleWriteDeploymentFlags, cancellable: R) -> Result<(), Error>;
#[cfg(any(feature = "v2018_5", feature = "dox"))]
fn stage_tree<'a, 'b, 'c, 'd, P: Into<Option<&'a str>>, Q: Into<Option<&'b glib::KeyFile>>, R: Into<Option<&'c Deployment>>, S: Into<Option<&'d gio::Cancellable>>>(&self, osname: P, revision: &str, origin: Q, merge_deployment: R, override_kernel_argv: &[&str], cancellable: S) -> Result<Deployment, Error>;
fn try_lock(&self) -> Result<bool, Error>;
fn unload(&self);
fn unlock(&self);
//fn write_deployments<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, new_deployments: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 19 }, cancellable: P) -> Result<(), Error>;
//#[cfg(any(feature = "v2017_4", feature = "dox"))]
//fn write_deployments_with_options<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, new_deployments: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 19 }, opts: /*Ignored*/&mut SysrootWriteDeploymentsOpts, cancellable: P) -> Result<(), Error>;
fn write_origin_file<'a, 'b, P: Into<Option<&'a glib::KeyFile>>, Q: Into<Option<&'b gio::Cancellable>>>(&self, deployment: &Deployment, new_origin: P, cancellable: Q) -> Result<(), Error>;
#[cfg(any(feature = "v2017_10", feature = "dox"))]
fn connect_journal_msg<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Sysroot> + IsA<glib::object::Object> + Clone + 'static> SysrootExt for O {
fn cleanup<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<(), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn cleanup<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_cleanup(self.to_glib_none().0, cancellable.0, &mut error);
let _ = ostree_sys::ostree_sysroot_cleanup(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
//#[cfg(any(feature = "v2018_6", feature = "dox"))]
//fn cleanup_prune_repo<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, options: /*Ignored*/&mut RepoPruneOptions, cancellable: P) -> Result<(i32, i32, u64), Error> {
// unsafe { TODO: call ffi::ostree_sysroot_cleanup_prune_repo() }
//pub fn cleanup_prune_repo<P: IsA<gio::Cancellable>>(&self, options: /*Ignored*/&mut RepoPruneOptions, cancellable: Option<&P>) -> Result<(i32, i32, u64), Error> {
// unsafe { TODO: call ostree_sys:ostree_sysroot_cleanup_prune_repo() }
//}
fn deploy_tree<'a, 'b, 'c, 'd, P: Into<Option<&'a str>>, Q: Into<Option<&'b glib::KeyFile>>, R: Into<Option<&'c Deployment>>, S: Into<Option<&'d gio::Cancellable>>>(&self, osname: P, revision: &str, origin: Q, provided_merge_deployment: R, override_kernel_argv: &[&str], cancellable: S) -> Result<Deployment, Error> {
let osname = osname.into();
let osname = osname.to_glib_none();
let origin = origin.into();
let origin = origin.to_glib_none();
let provided_merge_deployment = provided_merge_deployment.into();
let provided_merge_deployment = provided_merge_deployment.to_glib_none();
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn deploy_tree<P: IsA<gio::Cancellable>>(&self, osname: Option<&str>, revision: &str, origin: Option<&glib::KeyFile>, provided_merge_deployment: Option<&Deployment>, override_kernel_argv: &[&str], cancellable: Option<&P>) -> Result<Deployment, Error> {
unsafe {
let mut out_new_deployment = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_deploy_tree(self.to_glib_none().0, osname.0, revision.to_glib_none().0, origin.0, provided_merge_deployment.0, override_kernel_argv.to_glib_none().0, &mut out_new_deployment, cancellable.0, &mut error);
let _ = ostree_sys::ostree_sysroot_deploy_tree(self.to_glib_none().0, osname.to_glib_none().0, revision.to_glib_none().0, origin.to_glib_none().0, provided_merge_deployment.to_glib_none().0, override_kernel_argv.to_glib_none().0, &mut out_new_deployment, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(out_new_deployment)) } else { Err(from_glib_full(error)) }
}
}
fn deployment_set_kargs<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, deployment: &Deployment, new_kargs: &[&str], cancellable: P) -> Result<(), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn deployment_set_kargs<P: IsA<gio::Cancellable>>(&self, deployment: &Deployment, new_kargs: &[&str], cancellable: Option<&P>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_deployment_set_kargs(self.to_glib_none().0, deployment.to_glib_none().0, new_kargs.to_glib_none().0, cancellable.0, &mut error);
let _ = ostree_sys::ostree_sysroot_deployment_set_kargs(self.to_glib_none().0, deployment.to_glib_none().0, new_kargs.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
fn deployment_set_mutable<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, deployment: &Deployment, is_mutable: bool, cancellable: P) -> Result<(), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn deployment_set_mutable<P: IsA<gio::Cancellable>>(&self, deployment: &Deployment, is_mutable: bool, cancellable: Option<&P>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_deployment_set_mutable(self.to_glib_none().0, deployment.to_glib_none().0, is_mutable.to_glib(), cancellable.0, &mut error);
let _ = ostree_sys::ostree_sysroot_deployment_set_mutable(self.to_glib_none().0, deployment.to_glib_none().0, is_mutable.to_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[cfg(any(feature = "v2018_3", feature = "dox"))]
fn deployment_set_pinned(&self, deployment: &Deployment, is_pinned: bool) -> Result<(), Error> {
pub fn deployment_set_pinned(&self, deployment: &Deployment, is_pinned: bool) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_deployment_set_pinned(self.to_glib_none().0, deployment.to_glib_none().0, is_pinned.to_glib(), &mut error);
let _ = ostree_sys::ostree_sysroot_deployment_set_pinned(self.to_glib_none().0, deployment.to_glib_none().0, is_pinned.to_glib(), &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[cfg(any(feature = "v2016_4", feature = "dox"))]
fn deployment_unlock<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, deployment: &Deployment, unlocked_state: DeploymentUnlockedState, cancellable: P) -> Result<(), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn deployment_unlock<P: IsA<gio::Cancellable>>(&self, deployment: &Deployment, unlocked_state: DeploymentUnlockedState, cancellable: Option<&P>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_deployment_unlock(self.to_glib_none().0, deployment.to_glib_none().0, unlocked_state.to_glib(), cancellable.0, &mut error);
let _ = ostree_sys::ostree_sysroot_deployment_unlock(self.to_glib_none().0, deployment.to_glib_none().0, unlocked_state.to_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
fn ensure_initialized<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<(), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn ensure_initialized<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_ensure_initialized(self.to_glib_none().0, cancellable.0, &mut error);
let _ = ostree_sys::ostree_sysroot_ensure_initialized(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
fn get_booted_deployment(&self) -> Option<Deployment> {
pub fn get_booted_deployment(&self) -> Option<Deployment> {
unsafe {
from_glib_none(ffi::ostree_sysroot_get_booted_deployment(self.to_glib_none().0))
from_glib_none(ostree_sys::ostree_sysroot_get_booted_deployment(self.to_glib_none().0))
}
}
fn get_bootversion(&self) -> i32 {
pub fn get_bootversion(&self) -> i32 {
unsafe {
ffi::ostree_sysroot_get_bootversion(self.to_glib_none().0)
ostree_sys::ostree_sysroot_get_bootversion(self.to_glib_none().0)
}
}
fn get_deployment_directory(&self, deployment: &Deployment) -> Option<gio::File> {
pub fn get_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(ostree_sys::ostree_sysroot_get_deployment_directory(self.to_glib_none().0, deployment.to_glib_none().0))
}
}
fn get_deployment_dirpath(&self, deployment: &Deployment) -> Option<String> {
pub fn get_deployment_dirpath(&self, deployment: &Deployment) -> Option<GString> {
unsafe {
from_glib_full(ffi::ostree_sysroot_get_deployment_dirpath(self.to_glib_none().0, deployment.to_glib_none().0))
from_glib_full(ostree_sys::ostree_sysroot_get_deployment_dirpath(self.to_glib_none().0, deployment.to_glib_none().0))
}
}
//fn get_deployments(&self) -> /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 19 } {
// unsafe { TODO: call ffi::ostree_sysroot_get_deployments() }
//pub fn get_deployments(&self) -> /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 19 } {
// unsafe { TODO: call ostree_sys:ostree_sysroot_get_deployments() }
//}
fn get_fd(&self) -> i32 {
pub fn get_fd(&self) -> i32 {
unsafe {
ffi::ostree_sysroot_get_fd(self.to_glib_none().0)
ostree_sys::ostree_sysroot_get_fd(self.to_glib_none().0)
}
}
fn get_merge_deployment<'a, P: Into<Option<&'a str>>>(&self, osname: P) -> Option<Deployment> {
let osname = osname.into();
let osname = osname.to_glib_none();
pub fn get_merge_deployment(&self, osname: Option<&str>) -> Option<Deployment> {
unsafe {
from_glib_full(ffi::ostree_sysroot_get_merge_deployment(self.to_glib_none().0, osname.0))
from_glib_full(ostree_sys::ostree_sysroot_get_merge_deployment(self.to_glib_none().0, osname.to_glib_none().0))
}
}
fn get_path(&self) -> Option<gio::File> {
pub fn get_path(&self) -> Option<gio::File> {
unsafe {
from_glib_none(ffi::ostree_sysroot_get_path(self.to_glib_none().0))
from_glib_none(ostree_sys::ostree_sysroot_get_path(self.to_glib_none().0))
}
}
fn get_repo<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<Repo, Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn get_repo<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<Repo, Error> {
unsafe {
let mut out_repo = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_get_repo(self.to_glib_none().0, &mut out_repo, cancellable.0, &mut error);
let _ = ostree_sys::ostree_sysroot_get_repo(self.to_glib_none().0, &mut out_repo, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(out_repo)) } else { Err(from_glib_full(error)) }
}
}
#[cfg(any(feature = "v2018_5", feature = "dox"))]
fn get_staged_deployment(&self) -> Option<Deployment> {
pub fn get_staged_deployment(&self) -> Option<Deployment> {
unsafe {
from_glib_none(ffi::ostree_sysroot_get_staged_deployment(self.to_glib_none().0))
from_glib_none(ostree_sys::ostree_sysroot_get_staged_deployment(self.to_glib_none().0))
}
}
fn get_subbootversion(&self) -> i32 {
pub fn get_subbootversion(&self) -> i32 {
unsafe {
ffi::ostree_sysroot_get_subbootversion(self.to_glib_none().0)
ostree_sys::ostree_sysroot_get_subbootversion(self.to_glib_none().0)
}
}
#[cfg(any(feature = "v2016_4", feature = "dox"))]
fn init_osname<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, osname: &str, cancellable: P) -> Result<(), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn init_osname<P: IsA<gio::Cancellable>>(&self, osname: &str, cancellable: Option<&P>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_init_osname(self.to_glib_none().0, osname.to_glib_none().0, cancellable.0, &mut error);
let _ = ostree_sys::ostree_sysroot_init_osname(self.to_glib_none().0, osname.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
fn load<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<(), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn load<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_load(self.to_glib_none().0, cancellable.0, &mut error);
let _ = ostree_sys::ostree_sysroot_load(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[cfg(any(feature = "v2016_4", feature = "dox"))]
fn load_if_changed<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<bool, Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn load_if_changed<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<bool, Error> {
unsafe {
let mut out_changed = mem::uninitialized();
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_load_if_changed(self.to_glib_none().0, &mut out_changed, cancellable.0, &mut error);
let _ = ostree_sys::ostree_sysroot_load_if_changed(self.to_glib_none().0, &mut out_changed, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib(out_changed)) } else { Err(from_glib_full(error)) }
}
}
fn lock(&self) -> Result<(), Error> {
pub fn lock(&self) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_lock(self.to_glib_none().0, &mut error);
let _ = ostree_sys::ostree_sysroot_lock(self.to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
fn lock_async<'a, P: Into<Option<&'a gio::Cancellable>>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cancellable: P, callback: Q) {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
let user_data: Box<Box<Q>> = Box::new(Box::new(callback));
unsafe extern "C" fn lock_async_trampoline<Q: FnOnce(Result<(), Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer)
{
pub fn lock_async<P: IsA<gio::Cancellable>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, cancellable: Option<&P>, callback: Q) {
let user_data: Box<Q> = Box::new(callback);
unsafe extern "C" fn lock_async_trampoline<Q: FnOnce(Result<(), Error>) + Send + 'static>(_source_object: *mut gobject_sys::GObject, res: *mut gio_sys::GAsyncResult, user_data: glib_sys::gpointer) {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_lock_finish(_source_object as *mut _, res, &mut error);
let _ = ostree_sys::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<Box<Q>> = Box::from_raw(user_data as *mut _);
let callback: Box<Q> = Box::from_raw(user_data as *mut _);
callback(result);
}
let callback = lock_async_trampoline::<Q>;
unsafe {
ffi::ostree_sysroot_lock_async(self.to_glib_none().0, cancellable.0, Some(callback), Box::into_raw(user_data) as *mut _);
ostree_sys::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 _);
}
}
#[cfg(feature = "futures")]
fn lock_async_future(&self) -> Box_<futures_core::Future<Item = (Self, ()), Error = (Self, Error)>> {
pub fn lock_async_future(&self) -> Box_<future::Future<Output = Result<(), Error>> + std::marker::Unpin> {
use gio::GioFuture;
use fragile::Fragile;
GioFuture::new(self, move |obj, send| {
let cancellable = gio::Cancellable::new();
let send = Fragile::new(send);
let obj_clone = Fragile::new(obj.clone());
obj.lock_async(
Some(&cancellable),
move |res| {
let obj = obj_clone.into_inner();
let res = res.map(|v| (obj.clone(), v)).map_err(|v| (obj.clone(), v));
let _ = send.into_inner().send(res);
},
Some(&cancellable),
move |res| {
let _ = send.into_inner().send(res);
},
);
cancellable
})
}
fn origin_new_from_refspec(&self, refspec: &str) -> Option<glib::KeyFile> {
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(ostree_sys::ostree_sysroot_origin_new_from_refspec(self.to_glib_none().0, refspec.to_glib_none().0))
}
}
fn prepare_cleanup<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<(), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn prepare_cleanup<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_prepare_cleanup(self.to_glib_none().0, cancellable.0, &mut error);
let _ = ostree_sys::ostree_sysroot_prepare_cleanup(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[cfg(any(feature = "v2017_7", feature = "dox"))]
fn query_deployments_for<'a, P: Into<Option<&'a str>>>(&self, osname: P) -> (Deployment, Deployment) {
let osname = osname.into();
let osname = osname.to_glib_none();
pub fn query_deployments_for(&self, osname: Option<&str>) -> (Deployment, 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.0, &mut out_pending, &mut out_rollback);
ostree_sys::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))
}
}
#[cfg(any(feature = "v2017_7", feature = "dox"))]
fn repo(&self) -> Option<Repo> {
pub fn repo(&self) -> Option<Repo> {
unsafe {
from_glib_none(ffi::ostree_sysroot_repo(self.to_glib_none().0))
from_glib_none(ostree_sys::ostree_sysroot_repo(self.to_glib_none().0))
}
}
fn simple_write_deployment<'a, 'b, 'c, P: Into<Option<&'a str>>, Q: Into<Option<&'b Deployment>>, R: Into<Option<&'c gio::Cancellable>>>(&self, osname: P, new_deployment: &Deployment, merge_deployment: Q, flags: SysrootSimpleWriteDeploymentFlags, cancellable: R) -> Result<(), Error> {
let osname = osname.into();
let osname = osname.to_glib_none();
let merge_deployment = merge_deployment.into();
let merge_deployment = merge_deployment.to_glib_none();
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn simple_write_deployment<P: IsA<gio::Cancellable>>(&self, osname: Option<&str>, new_deployment: &Deployment, merge_deployment: Option<&Deployment>, flags: SysrootSimpleWriteDeploymentFlags, cancellable: Option<&P>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_simple_write_deployment(self.to_glib_none().0, osname.0, new_deployment.to_glib_none().0, merge_deployment.0, flags.to_glib(), cancellable.0, &mut error);
let _ = ostree_sys::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.to_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[cfg(any(feature = "v2018_5", feature = "dox"))]
fn stage_tree<'a, 'b, 'c, 'd, P: Into<Option<&'a str>>, Q: Into<Option<&'b glib::KeyFile>>, R: Into<Option<&'c Deployment>>, S: Into<Option<&'d gio::Cancellable>>>(&self, osname: P, revision: &str, origin: Q, merge_deployment: R, override_kernel_argv: &[&str], cancellable: S) -> Result<Deployment, Error> {
let osname = osname.into();
let osname = osname.to_glib_none();
let origin = origin.into();
let origin = origin.to_glib_none();
let merge_deployment = merge_deployment.into();
let merge_deployment = merge_deployment.to_glib_none();
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn stage_tree<P: IsA<gio::Cancellable>>(&self, osname: Option<&str>, revision: &str, origin: Option<&glib::KeyFile>, merge_deployment: Option<&Deployment>, override_kernel_argv: &[&str], cancellable: Option<&P>) -> Result<Deployment, Error> {
unsafe {
let mut out_new_deployment = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_stage_tree(self.to_glib_none().0, osname.0, revision.to_glib_none().0, origin.0, merge_deployment.0, override_kernel_argv.to_glib_none().0, &mut out_new_deployment, cancellable.0, &mut error);
let _ = ostree_sys::ostree_sysroot_stage_tree(self.to_glib_none().0, osname.to_glib_none().0, revision.to_glib_none().0, origin.to_glib_none().0, merge_deployment.to_glib_none().0, override_kernel_argv.to_glib_none().0, &mut out_new_deployment, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(out_new_deployment)) } else { Err(from_glib_full(error)) }
}
}
fn try_lock(&self) -> Result<bool, Error> {
pub fn try_lock(&self) -> Result<bool, Error> {
unsafe {
let mut out_acquired = mem::uninitialized();
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_try_lock(self.to_glib_none().0, &mut out_acquired, &mut error);
let _ = ostree_sys::ostree_sysroot_try_lock(self.to_glib_none().0, &mut out_acquired, &mut error);
if error.is_null() { Ok(from_glib(out_acquired)) } else { Err(from_glib_full(error)) }
}
}
fn unload(&self) {
pub fn unload(&self) {
unsafe {
ffi::ostree_sysroot_unload(self.to_glib_none().0);
ostree_sys::ostree_sysroot_unload(self.to_glib_none().0);
}
}
fn unlock(&self) {
pub fn unlock(&self) {
unsafe {
ffi::ostree_sysroot_unlock(self.to_glib_none().0);
ostree_sys::ostree_sysroot_unlock(self.to_glib_none().0);
}
}
//fn write_deployments<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, new_deployments: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 19 }, cancellable: P) -> Result<(), Error> {
// unsafe { TODO: call ffi::ostree_sysroot_write_deployments() }
//pub fn write_deployments<P: IsA<gio::Cancellable>>(&self, new_deployments: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 19 }, cancellable: Option<&P>) -> Result<(), Error> {
// unsafe { TODO: call ostree_sys:ostree_sysroot_write_deployments() }
//}
//#[cfg(any(feature = "v2017_4", feature = "dox"))]
//fn write_deployments_with_options<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, new_deployments: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 19 }, opts: /*Ignored*/&mut SysrootWriteDeploymentsOpts, cancellable: P) -> Result<(), Error> {
// unsafe { TODO: call ffi::ostree_sysroot_write_deployments_with_options() }
//pub fn write_deployments_with_options<P: IsA<gio::Cancellable>>(&self, new_deployments: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 19 }, opts: /*Ignored*/&mut SysrootWriteDeploymentsOpts, cancellable: Option<&P>) -> Result<(), Error> {
// unsafe { TODO: call ostree_sys:ostree_sysroot_write_deployments_with_options() }
//}
fn write_origin_file<'a, 'b, P: Into<Option<&'a glib::KeyFile>>, Q: Into<Option<&'b gio::Cancellable>>>(&self, deployment: &Deployment, new_origin: P, cancellable: Q) -> Result<(), Error> {
let new_origin = new_origin.into();
let new_origin = new_origin.to_glib_none();
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn write_origin_file<P: IsA<gio::Cancellable>>(&self, deployment: &Deployment, new_origin: Option<&glib::KeyFile>, cancellable: Option<&P>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_write_origin_file(self.to_glib_none().0, deployment.to_glib_none().0, new_origin.0, cancellable.0, &mut error);
let _ = ostree_sys::ostree_sysroot_write_origin_file(self.to_glib_none().0, deployment.to_glib_none().0, new_origin.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[cfg(any(feature = "v2017_10", feature = "dox"))]
fn connect_journal_msg<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
pub fn get_deployment_origin_path<P: IsA<gio::File>>(deployment_path: &P) -> Option<gio::File> {
unsafe {
let f: Box_<Box_<Fn(&Self, &str) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "journal-msg",
transmute(journal_msg_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
from_glib_full(ostree_sys::ostree_sysroot_get_deployment_origin_path(deployment_path.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v2017_10", feature = "dox"))]
pub fn connect_journal_msg<F: Fn(&Sysroot, &str) + 'static>(&self, f: F) -> SignalHandlerId {
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(journal_msg_trampoline::<F> as usize)), Box_::into_raw(f))
}
}
}
#[cfg(any(feature = "v2017_10", feature = "dox"))]
unsafe extern "C" fn journal_msg_trampoline<P>(this: *mut ffi::OstreeSysroot, msg: *mut libc::c_char, f: glib_ffi::gpointer)
where P: IsA<Sysroot> {
let f: &&(Fn(&P, &str) + 'static) = transmute(f);
f(&Sysroot::from_glib_borrow(this).downcast_unchecked(), &String::from_glib_none(msg))
unsafe extern "C" fn journal_msg_trampoline<F: Fn(&Sysroot, &str) + 'static>(this: *mut ostree_sys::OstreeSysroot, msg: *mut libc::c_char, f: glib_sys::gpointer) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this), &GString::from_glib_borrow(msg))
}
impl fmt::Display for Sysroot {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Sysroot")
}
}

View File

@ -9,180 +9,140 @@ use RepoPullFlags;
use Sysroot;
use SysrootUpgraderFlags;
use SysrootUpgraderPullFlags;
use ffi;
use gio;
use glib;
use glib::GString;
use glib::StaticType;
use glib::Value;
use glib::object::IsA;
use glib::object::ObjectType as _;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gobject_sys;
use ostree_sys;
use std::fmt;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct SysrootUpgrader(Object<ffi::OstreeSysrootUpgrader>);
pub struct SysrootUpgrader(Object<ostree_sys::OstreeSysrootUpgrader, SysrootUpgraderClass>);
match fn {
get_type => || ffi::ostree_sysroot_upgrader_get_type(),
get_type => || ostree_sys::ostree_sysroot_upgrader_get_type(),
}
}
impl SysrootUpgrader {
pub fn new<'a, P: Into<Option<&'a gio::Cancellable>>>(sysroot: &Sysroot, cancellable: P) -> Result<SysrootUpgrader, Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn new<P: IsA<gio::Cancellable>>(sysroot: &Sysroot, cancellable: Option<&P>) -> Result<SysrootUpgrader, Error> {
unsafe {
let mut error = ptr::null_mut();
let ret = ffi::ostree_sysroot_upgrader_new(sysroot.to_glib_none().0, cancellable.0, &mut error);
let ret = ostree_sys::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)) }
}
}
pub fn new_for_os<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b gio::Cancellable>>>(sysroot: &Sysroot, osname: P, cancellable: Q) -> Result<SysrootUpgrader, Error> {
let osname = osname.into();
let osname = osname.to_glib_none();
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn new_for_os<P: IsA<gio::Cancellable>>(sysroot: &Sysroot, osname: Option<&str>, cancellable: Option<&P>) -> Result<SysrootUpgrader, Error> {
unsafe {
let mut error = ptr::null_mut();
let ret = ffi::ostree_sysroot_upgrader_new_for_os(sysroot.to_glib_none().0, osname.0, cancellable.0, &mut error);
let ret = ostree_sys::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)) }
}
}
pub fn new_for_os_with_flags<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b gio::Cancellable>>>(sysroot: &Sysroot, osname: P, flags: SysrootUpgraderFlags, cancellable: Q) -> Result<SysrootUpgrader, Error> {
let osname = osname.into();
let osname = osname.to_glib_none();
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
pub fn new_for_os_with_flags<P: IsA<gio::Cancellable>>(sysroot: &Sysroot, osname: Option<&str>, flags: SysrootUpgraderFlags, cancellable: Option<&P>) -> Result<SysrootUpgrader, 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.0, flags.to_glib(), cancellable.0, &mut error);
let ret = ostree_sys::ostree_sysroot_upgrader_new_for_os_with_flags(sysroot.to_glib_none().0, osname.to_glib_none().0, flags.to_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)) }
}
}
pub fn deploy<P: IsA<gio::Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ostree_sys::ostree_sysroot_upgrader_deploy(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
pub fn dup_origin(&self) -> Option<glib::KeyFile> {
unsafe {
from_glib_full(ostree_sys::ostree_sysroot_upgrader_dup_origin(self.to_glib_none().0))
}
}
pub fn get_origin(&self) -> Option<glib::KeyFile> {
unsafe {
from_glib_none(ostree_sys::ostree_sysroot_upgrader_get_origin(self.to_glib_none().0))
}
}
pub fn get_origin_description(&self) -> Option<GString> {
unsafe {
from_glib_full(ostree_sys::ostree_sysroot_upgrader_get_origin_description(self.to_glib_none().0))
}
}
pub fn pull<P: IsA<AsyncProgress>, Q: IsA<gio::Cancellable>>(&self, flags: RepoPullFlags, upgrader_flags: SysrootUpgraderPullFlags, progress: Option<&P>, cancellable: Option<&Q>) -> Result<bool, Error> {
unsafe {
let mut out_changed = mem::uninitialized();
let mut error = ptr::null_mut();
let _ = ostree_sys::ostree_sysroot_upgrader_pull(self.to_glib_none().0, flags.to_glib(), upgrader_flags.to_glib(), progress.map(|p| p.as_ref()).to_glib_none().0, &mut out_changed, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib(out_changed)) } else { Err(from_glib_full(error)) }
}
}
pub fn pull_one_dir<P: IsA<AsyncProgress>, Q: IsA<gio::Cancellable>>(&self, dir_to_pull: &str, flags: RepoPullFlags, upgrader_flags: SysrootUpgraderPullFlags, progress: Option<&P>, cancellable: Option<&Q>) -> Result<bool, Error> {
unsafe {
let mut out_changed = mem::uninitialized();
let mut error = ptr::null_mut();
let _ = ostree_sys::ostree_sysroot_upgrader_pull_one_dir(self.to_glib_none().0, dir_to_pull.to_glib_none().0, flags.to_glib(), upgrader_flags.to_glib(), progress.map(|p| p.as_ref()).to_glib_none().0, &mut out_changed, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib(out_changed)) } else { Err(from_glib_full(error)) }
}
}
pub fn set_origin<P: IsA<gio::Cancellable>>(&self, origin: Option<&glib::KeyFile>, cancellable: Option<&P>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ostree_sys::ostree_sysroot_upgrader_set_origin(self.to_glib_none().0, origin.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
pub fn get_property_flags(&self) -> SysrootUpgraderFlags {
unsafe {
let mut value = Value::from_type(<SysrootUpgraderFlags as StaticType>::static_type());
gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"flags\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
pub fn get_property_osname(&self) -> Option<GString> {
unsafe {
let mut value = Value::from_type(<GString as StaticType>::static_type());
gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"osname\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get()
}
}
pub fn get_property_sysroot(&self) -> Option<Sysroot> {
unsafe {
let mut value = Value::from_type(<Sysroot as StaticType>::static_type());
gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"sysroot\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get()
}
}
pub fn check_timestamps(repo: &Repo, from_rev: &str, to_rev: &str) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_upgrader_check_timestamps(repo.to_glib_none().0, from_rev.to_glib_none().0, to_rev.to_glib_none().0, &mut error);
let _ = ostree_sys::ostree_sysroot_upgrader_check_timestamps(repo.to_glib_none().0, from_rev.to_glib_none().0, to_rev.to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
}
pub trait SysrootUpgraderExt {
fn deploy<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<(), Error>;
fn dup_origin(&self) -> Option<glib::KeyFile>;
fn get_origin(&self) -> Option<glib::KeyFile>;
fn get_origin_description(&self) -> Option<String>;
fn pull<'a, 'b, P: Into<Option<&'a AsyncProgress>>, Q: Into<Option<&'b gio::Cancellable>>>(&self, flags: RepoPullFlags, upgrader_flags: SysrootUpgraderPullFlags, progress: P, cancellable: Q) -> Result<bool, Error>;
fn pull_one_dir<'a, 'b, P: Into<Option<&'a AsyncProgress>>, Q: Into<Option<&'b gio::Cancellable>>>(&self, dir_to_pull: &str, flags: RepoPullFlags, upgrader_flags: SysrootUpgraderPullFlags, progress: P, cancellable: Q) -> Result<bool, Error>;
fn set_origin<'a, 'b, P: Into<Option<&'a glib::KeyFile>>, Q: Into<Option<&'b gio::Cancellable>>>(&self, origin: P, cancellable: Q) -> Result<(), Error>;
fn get_property_flags(&self) -> SysrootUpgraderFlags;
fn get_property_osname(&self) -> Option<String>;
fn get_property_sysroot(&self) -> Option<Sysroot>;
}
impl<O: IsA<SysrootUpgrader> + IsA<glib::object::Object>> SysrootUpgraderExt for O {
fn deploy<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<(), Error> {
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_upgrader_deploy(self.to_glib_none().0, cancellable.0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
fn dup_origin(&self) -> Option<glib::KeyFile> {
unsafe {
from_glib_full(ffi::ostree_sysroot_upgrader_dup_origin(self.to_glib_none().0))
}
}
fn get_origin(&self) -> Option<glib::KeyFile> {
unsafe {
from_glib_none(ffi::ostree_sysroot_upgrader_get_origin(self.to_glib_none().0))
}
}
fn get_origin_description(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::ostree_sysroot_upgrader_get_origin_description(self.to_glib_none().0))
}
}
fn pull<'a, 'b, P: Into<Option<&'a AsyncProgress>>, Q: Into<Option<&'b gio::Cancellable>>>(&self, flags: RepoPullFlags, upgrader_flags: SysrootUpgraderPullFlags, progress: P, cancellable: Q) -> Result<bool, Error> {
let progress = progress.into();
let progress = progress.to_glib_none();
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
unsafe {
let mut out_changed = mem::uninitialized();
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_upgrader_pull(self.to_glib_none().0, flags.to_glib(), upgrader_flags.to_glib(), progress.0, &mut out_changed, cancellable.0, &mut error);
if error.is_null() { Ok(from_glib(out_changed)) } else { Err(from_glib_full(error)) }
}
}
fn pull_one_dir<'a, 'b, P: Into<Option<&'a AsyncProgress>>, Q: Into<Option<&'b gio::Cancellable>>>(&self, dir_to_pull: &str, flags: RepoPullFlags, upgrader_flags: SysrootUpgraderPullFlags, progress: P, cancellable: Q) -> Result<bool, Error> {
let progress = progress.into();
let progress = progress.to_glib_none();
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
unsafe {
let mut out_changed = mem::uninitialized();
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_upgrader_pull_one_dir(self.to_glib_none().0, dir_to_pull.to_glib_none().0, flags.to_glib(), upgrader_flags.to_glib(), progress.0, &mut out_changed, cancellable.0, &mut error);
if error.is_null() { Ok(from_glib(out_changed)) } else { Err(from_glib_full(error)) }
}
}
fn set_origin<'a, 'b, P: Into<Option<&'a glib::KeyFile>>, Q: Into<Option<&'b gio::Cancellable>>>(&self, origin: P, cancellable: Q) -> Result<(), Error> {
let origin = origin.into();
let origin = origin.to_glib_none();
let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sysroot_upgrader_set_origin(self.to_glib_none().0, origin.0, cancellable.0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
fn get_property_flags(&self) -> SysrootUpgraderFlags {
unsafe {
let mut value = Value::from_type(<SysrootUpgraderFlags as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "flags".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn get_property_osname(&self) -> Option<String> {
unsafe {
let mut value = Value::from_type(<String as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "osname".to_glib_none().0, value.to_glib_none_mut().0);
value.get()
}
}
fn get_property_sysroot(&self) -> Option<Sysroot> {
unsafe {
let mut value = Value::from_type(<Sysroot as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "sysroot".to_glib_none().0, value.to_glib_none_mut().0);
value.get()
}
impl fmt::Display for SysrootUpgrader {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "SysrootUpgrader")
}
}

View File

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ffda6f9)
Generated by gir (https://github.com/gtk-rs/gir @ fec179c)
from gir-files (https://github.com/gtk-rs/gir-files @ ???)

View File

@ -1,31 +1,30 @@
// Based on a file generated by gir. Changes are marked below.
use ffi;
#[cfg(any(feature = "v2018_6", feature = "dox"))]
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use glib_sys;
use gobject_sys;
use ostree_sys;
use std::hash;
use std::mem;
use std::ptr;
glib_wrapper! {
#[derive(Debug, PartialOrd, Ord)]
pub struct CollectionRef(Boxed<ffi::OstreeCollectionRef>);
pub struct CollectionRef(Boxed<ostree_sys::OstreeCollectionRef>);
match fn {
copy => |ptr| gobject_ffi::g_boxed_copy(ffi::ostree_collection_ref_get_type(), ptr as *mut _) as *mut ffi::OstreeCollectionRef,
free => |ptr| gobject_ffi::g_boxed_free(ffi::ostree_collection_ref_get_type(), ptr as *mut _),
get_type => || ffi::ostree_collection_ref_get_type(),
copy => |ptr| gobject_sys::g_boxed_copy(ostree_sys::ostree_collection_ref_get_type(), ptr as *mut _) as *mut ostree_sys::OstreeCollectionRef,
free => |ptr| gobject_sys::g_boxed_free(ostree_sys::ostree_collection_ref_get_type(), ptr as *mut _),
get_type => || ostree_sys::ostree_collection_ref_get_type(),
}
}
impl CollectionRef {
#[cfg(any(feature = "v2018_6", feature = "dox"))]
// CHANGE: return type CollectionRef to Option<CollectionRef>
pub fn new<'a, P: Into<Option<&'a str>>>(collection_id: P, ref_name: &str) -> Option<CollectionRef> {
let collection_id = collection_id.into();
let collection_id = collection_id.to_glib_none();
pub fn new(collection_id: Option<&str>, ref_name: &str) -> Option<CollectionRef> {
unsafe {
from_glib_full(ffi::ostree_collection_ref_new(collection_id.0, ref_name.to_glib_none().0))
from_glib_full(ostree_sys::ostree_collection_ref_new(
collection_id.to_glib_none().0,
ref_name.to_glib_none().0,
))
}
}
@ -33,7 +32,12 @@ impl CollectionRef {
fn equal(&self, ref2: &CollectionRef) -> bool {
unsafe {
// CHANGE: both instances of *mut to *const
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(ostree_sys::ostree_collection_ref_equal(
ToGlibPtr::<*const ostree_sys::OstreeCollectionRef>::to_glib_none(self).0
as glib_sys::gconstpointer,
ToGlibPtr::<*const ostree_sys::OstreeCollectionRef>::to_glib_none(ref2).0
as glib_sys::gconstpointer,
))
}
}
@ -41,7 +45,10 @@ impl CollectionRef {
fn hash(&self) -> u32 {
unsafe {
// CHANGE: *mut to *const
ffi::ostree_collection_ref_hash(ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(self).0 as glib_ffi::gconstpointer)
ostree_sys::ostree_collection_ref_hash(
ToGlibPtr::<*const ostree_sys::OstreeCollectionRef>::to_glib_none(self).0
as glib_sys::gconstpointer,
)
}
}
}
@ -57,7 +64,10 @@ impl Eq for CollectionRef {}
impl hash::Hash for CollectionRef {
#[inline]
fn hash<H>(&self, state: &mut H) where H: hash::Hasher {
fn hash<H>(&self, state: &mut H)
where
H: hash::Hasher,
{
hash::Hash::hash(&self.hash(), state)
}
}

View File

@ -1,6 +1,6 @@
use super::*;
use std::hash::{Hash, Hasher};
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
fn hash(v: &impl Hash) -> u64 {
let mut s = DefaultHasher::new();
@ -10,14 +10,14 @@ fn hash(v: &impl Hash) -> u64 {
#[test]
fn same_value_should_be_equal() {
let r = CollectionRef::new("io.gitlab.fkrull", "ref").unwrap();
let r = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap();
assert_eq!(r, r);
}
#[test]
fn equal_values_should_be_equal() {
let a = CollectionRef::new("io.gitlab.fkrull", "ref").unwrap();
let b = CollectionRef::new("io.gitlab.fkrull", "ref").unwrap();
let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap();
let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap();
assert_eq!(a, b);
}
@ -30,48 +30,48 @@ fn equal_values_without_collection_id_should_be_equal() {
#[test]
fn different_values_should_not_be_equal() {
let a = CollectionRef::new("io.gitlab.fkrull", "ref1").unwrap();
let b = CollectionRef::new("io.gitlab.fkrull", "ref2").unwrap();
let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref1").unwrap();
let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref2").unwrap();
assert_ne!(a, b);
}
#[test]
fn new_with_invalid_collection_id_should_return_none() {
let r = CollectionRef::new(".abc", "ref");
let r = CollectionRef::new(Some(".abc"), "ref");
assert_eq!(r, None);
}
#[test]
fn hash_for_equal_values_should_be_equal() {
let a = CollectionRef::new("io.gitlab.fkrull", "ref").unwrap();
let b = CollectionRef::new("io.gitlab.fkrull", "ref").unwrap();
let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap();
let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap();
assert_eq!(hash(&a), hash(&b));
}
#[test]
fn hash_for_values_with_different_collection_id_should_be_different() {
let a = CollectionRef::new("io.gitlab.fkrull1", "ref").unwrap();
let b = CollectionRef::new("io.gitlab.fkrull2", "ref").unwrap();
let a = CollectionRef::new(Some("io.gitlab.fkrull1"), "ref").unwrap();
let b = CollectionRef::new(Some("io.gitlab.fkrull2"), "ref").unwrap();
assert_ne!(hash(&a), hash(&b));
}
#[test]
fn hash_for_values_with_different_ref_id_should_be_different() {
let a = CollectionRef::new("io.gitlab.fkrull", "ref-1").unwrap();
let b = CollectionRef::new("io.gitlab.fkrull", "ref-2").unwrap();
let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref-1").unwrap();
let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref-2").unwrap();
assert_ne!(hash(&a), hash(&b));
}
#[test]
fn hash_should_be_different_if_collection_id_is_absent() {
let a = CollectionRef::new("io.gitlab.fkrull", "ref").unwrap();
let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap();
let b = CollectionRef::new(None, "ref").unwrap();
assert_ne!(hash(&a), hash(&b));
}
#[test]
fn clone_should_be_equal_to_original_value() {
let a = CollectionRef::new("io.gitlab.fkrull", "ref").unwrap();
let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap();
let b = a.clone();
assert_eq!(a, b);
}

View File

@ -1,7 +1,7 @@
extern crate gio_sys as gio_ffi;
extern crate glib_sys as glib_ffi;
extern crate gobject_sys as gobject_ffi;
extern crate ostree_sys as ffi;
extern crate gio_sys;
extern crate glib_sys;
extern crate gobject_sys;
extern crate ostree_sys;
#[macro_use]
extern crate glib;
extern crate gio;

View File

@ -1,8 +1,8 @@
use ffi;
use functions::{object_name_deserialize, object_name_serialize, object_to_string};
use glib;
use glib::translate::*;
use glib_ffi;
use glib_sys;
use ostree_sys;
use std::fmt::Display;
use std::fmt::Error;
use std::fmt::Formatter;
@ -11,12 +11,13 @@ use std::hash::Hasher;
use ObjectType;
fn hash_object_name(v: &glib::Variant) -> u32 {
unsafe { ffi::ostree_hash_object_name(v.to_glib_none().0 as glib_ffi::gconstpointer) }
unsafe { ostree_sys::ostree_hash_object_name(v.to_glib_none().0 as glib_sys::gconstpointer) }
}
#[derive(Eq, Debug)]
pub struct ObjectName {
variant: glib::Variant,
// TODO: can I store a GString here?
checksum: String,
object_type: ObjectType,
}
@ -26,7 +27,7 @@ impl ObjectName {
let deserialize = object_name_deserialize(&variant);
ObjectName {
variant,
checksum: deserialize.0,
checksum: deserialize.0.into(),
object_type: deserialize.1,
}
}
@ -49,9 +50,11 @@ impl ObjectName {
self.object_type
}
// TODO: return GString
pub fn name(&self) -> String {
object_to_string(self.checksum(), self.object_type())
.expect("type checks should make this safe")
.into()
}
}

View File

@ -1,84 +1,85 @@
use crate::auto::Repo;
use crate::Repo;
#[cfg(any(feature = "v2016_4", feature = "dox"))]
use crate::auto::RepoListRefsExtFlags;
use ffi;
use crate::RepoListRefsExtFlags;
use gio;
use glib;
use glib::translate::*;
use glib::Error;
use glib::IsA;
use glib_ffi;
use glib_sys;
use ostree_sys;
use std::collections::{HashMap, HashSet};
use std::path::Path;
use std::ptr;
use ObjectName;
unsafe extern "C" fn read_variant_table(
_key: glib_ffi::gpointer,
value: glib_ffi::gpointer,
hash_set: glib_ffi::gpointer,
_key: glib_sys::gpointer,
value: glib_sys::gpointer,
hash_set: glib_sys::gpointer,
) {
let value: glib::Variant = from_glib_none(value as *const glib_ffi::GVariant);
let value: glib::Variant = from_glib_none(value as *const glib_sys::GVariant);
let set: &mut HashSet<ObjectName> = &mut *(hash_set as *mut HashSet<ObjectName>);
set.insert(ObjectName::new_from_variant(value));
}
unsafe fn from_glib_container_variant_set(ptr: *mut glib_ffi::GHashTable) -> HashSet<ObjectName> {
unsafe fn from_glib_container_variant_set(ptr: *mut glib_sys::GHashTable) -> HashSet<ObjectName> {
let mut set = HashSet::new();
glib_ffi::g_hash_table_foreach(
glib_sys::g_hash_table_foreach(
ptr,
Some(read_variant_table),
&mut set as *mut HashSet<ObjectName> as *mut _,
);
glib_ffi::g_hash_table_unref(ptr);
glib_sys::g_hash_table_unref(ptr);
set
}
pub trait RepoExtManual {
fn new_for_path<P: AsRef<Path>>(path: P) -> Repo;
fn traverse_commit<'a, P: Into<Option<&'a gio::Cancellable>>>(
fn traverse_commit<P: IsA<gio::Cancellable>>(
&self,
commit_checksum: &str,
maxdepth: i32,
cancellable: P,
cancellable: Option<&P>,
) -> Result<HashSet<ObjectName>, Error>;
fn list_refs<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b gio::Cancellable>>>(
// TODO: return GString?
fn list_refs<P: IsA<gio::Cancellable>>(
&self,
refspec_prefix: P,
cancellable: Q,
refspec_prefix: Option<&str>,
cancellable: Option<&P>,
) -> Result<HashMap<String, String>, Error>;
#[cfg(any(feature = "v2016_4", feature = "dox"))]
fn list_refs_ext<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b gio::Cancellable>>>(
fn list_refs_ext<P: IsA<gio::Cancellable>>(
&self,
refspec_prefix: P,
refspec_prefix: Option<&str>,
flags: RepoListRefsExtFlags,
cancellable: Q,
cancellable: Option<&P>,
) -> Result<HashMap<String, String>, Error>;
}
impl<O: IsA<Repo> + IsA<glib::Object> + Clone + 'static> RepoExtManual for O {
impl<O: IsA<Repo>> RepoExtManual for O {
fn new_for_path<P: AsRef<Path>>(path: P) -> Repo {
Repo::new(&gio::File::new_for_path(path.as_ref()))
}
fn traverse_commit<'a, P: Into<Option<&'a gio::Cancellable>>>(
fn traverse_commit<P: IsA<gio::Cancellable>>(
&self,
commit_checksum: &str,
maxdepth: i32,
cancellable: P,
cancellable: Option<&P>,
) -> Result<HashSet<ObjectName>, Error> {
unsafe {
let mut error = ptr::null_mut();
let mut hashtable = ptr::null_mut();
let _ = ffi::ostree_repo_traverse_commit(
self.to_glib_none().0,
let _ = ostree_sys::ostree_repo_traverse_commit(
self.as_ref().to_glib_none().0,
commit_checksum.to_glib_none().0,
maxdepth,
&mut hashtable,
cancellable.into().to_glib_none().0,
cancellable.map(|p| p.as_ref()).to_glib_none().0,
&mut error,
);
if error.is_null() {
@ -89,19 +90,19 @@ impl<O: IsA<Repo> + IsA<glib::Object> + Clone + 'static> RepoExtManual for O {
}
}
fn list_refs<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b gio::Cancellable>>>(
fn list_refs<P: IsA<gio::Cancellable>>(
&self,
refspec_prefix: P,
cancellable: Q,
refspec_prefix: Option<&str>,
cancellable: Option<&P>,
) -> Result<HashMap<String, String>, Error> {
unsafe {
let mut error = ptr::null_mut();
let mut hashtable = ptr::null_mut();
let _ = ffi::ostree_repo_list_refs(
self.to_glib_none().0,
refspec_prefix.into().to_glib_none().0,
let _ = ostree_sys::ostree_repo_list_refs(
self.as_ref().to_glib_none().0,
refspec_prefix.to_glib_none().0,
&mut hashtable,
cancellable.into().to_glib_none().0,
cancellable.map(|p| p.as_ref()).to_glib_none().0,
&mut error,
);
@ -114,21 +115,21 @@ impl<O: IsA<Repo> + IsA<glib::Object> + Clone + 'static> RepoExtManual for O {
}
#[cfg(any(feature = "v2016_4", feature = "dox"))]
fn list_refs_ext<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b gio::Cancellable>>>(
fn list_refs_ext<P: IsA<gio::Cancellable>>(
&self,
refspec_prefix: P,
refspec_prefix: Option<&str>,
flags: RepoListRefsExtFlags,
cancellable: Q,
cancellable: Option<&P>,
) -> Result<HashMap<String, String>, Error> {
unsafe {
let mut error = ptr::null_mut();
let mut hashtable = ptr::null_mut();
let _ = ffi::ostree_repo_list_refs_ext(
self.to_glib_none().0,
refspec_prefix.into().to_glib_none().0,
let _ = ostree_sys::ostree_repo_list_refs_ext(
self.as_ref().to_glib_none().0,
refspec_prefix.to_glib_none().0,
&mut hashtable,
flags.to_glib(),
cancellable.into().to_glib_none().0,
cancellable.map(|p| p.as_ref()).to_glib_none().0,
&mut error,
);

View File

@ -3,15 +3,17 @@ extern crate glib;
extern crate ostree;
extern crate tempfile;
use gio::NONE_CANCELLABLE;
use glib::prelude::*;
use ostree::prelude::*;
use ostree::RepoFile;
use std::fs;
use std::io;
use std::io::Write;
fn create_repo(repodir: &tempfile::TempDir) -> Result<ostree::Repo, glib::Error> {
let repo = ostree::Repo::new_for_path(repodir.path());
repo.create(ostree::RepoMode::Archive, None)?;
repo.create(ostree::RepoMode::Archive, NONE_CANCELLABLE)?;
Ok(repo)
}
@ -27,25 +29,34 @@ fn create_mtree(
) -> Result<ostree::MutableTree, glib::Error> {
let gfile = gio::File::new_for_path(treedir.path());
let mtree = ostree::MutableTree::new();
repo.write_directory_to_mtree(&gfile, &mtree, None, None)?;
repo.write_directory_to_mtree(&gfile, &mtree, None, NONE_CANCELLABLE)?;
Ok(mtree)
}
fn commit_mtree(
repo: &ostree::Repo,
mtree: &ostree::MutableTree,
) -> Result<String, glib::Error> {
repo.prepare_transaction(None)?;
let repo_file = repo.write_mtree(mtree, None)?.downcast().unwrap();
let checksum = repo.write_commit(None, "Test Commit", None, None, &repo_file, None)?;
repo.transaction_set_ref(None, "test", checksum.as_str());
repo.commit_transaction(None)?;
fn commit_mtree(repo: &ostree::Repo, mtree: &ostree::MutableTree) -> Result<String, glib::Error> {
repo.prepare_transaction(NONE_CANCELLABLE)?;
let repo_file = repo
.write_mtree(mtree, NONE_CANCELLABLE)?
.downcast::<RepoFile>()
.unwrap();
let checksum = repo
.write_commit(
None,
"Test Commit".into(),
None,
None,
&repo_file,
NONE_CANCELLABLE,
)?
.to_string();
repo.transaction_set_ref(None, "test", checksum.as_str().into());
repo.commit_transaction(NONE_CANCELLABLE)?;
Ok(checksum)
}
fn open_repo(repodir: &tempfile::TempDir) -> Result<ostree::Repo, glib::Error> {
let repo = ostree::Repo::new_for_path(repodir.path());
repo.open(None)?;
repo.open(NONE_CANCELLABLE)?;
Ok(repo)
}
@ -60,7 +71,9 @@ fn should_commit_content_to_repo_and_list_refs_again() {
let checksum = commit_mtree(&repo, &mtree).expect("failed to commit mtree");
let repo = open_repo(&repodir).expect("failed to open repo");
let refs = repo.list_refs(None, None).expect("failed to list refs");
let refs = repo
.list_refs(None, NONE_CANCELLABLE)
.expect("failed to list refs");
assert_eq!(refs.len(), 1);
assert_eq!(refs["test"], checksum);
}