Move main crate into repo root

This commit is contained in:
Felix Krull authored and Colin Walters committed 2022-05-06 12:53:53 -04:00
1 parent a16ea65e0f
commit ced47cbb26
23 files changed
+62 -60

No files matched your search

@@ -0,0 +1,161 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ ffda6f9)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use ffi;
use glib;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct AsyncProgress(Object<ffi::OstreeAsyncProgress, ffi::OstreeAsyncProgressClass>);
match fn {
get_type => || ffi::ostree_async_progress_get_type(),
}
}
impl AsyncProgress {
pub fn new() -> AsyncProgress {
unsafe {
from_glib_full(ffi::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() }
//}
}
impl Default for AsyncProgress {
fn default() -> Self {
Self::new()
}
}
pub trait AsyncProgressExt {
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_uint(&self, key: &str) -> u32;
fn get_uint64(&self, key: &str) -> u64;
#[cfg(any(feature = "v2017_6", feature = "dox"))]
fn get_variant(&self, key: &str) -> Option<glib::Variant>;
//#[cfg(any(feature = "v2017_6", feature = "dox"))]
//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_uint(&self, key: &str, value: u32);
fn set_uint64(&self, key: &str, value: u64);
#[cfg(any(feature = "v2017_6", feature = "dox"))]
fn set_variant(&self, key: &str, value: &glib::Variant);
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<AsyncProgress> + IsA<glib::object::Object>> AsyncProgressExt for O {
fn finish(&self) {
unsafe {
ffi::ostree_async_progress_finish(self.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() }
//}
#[cfg(any(feature = "v2017_6", feature = "dox"))]
fn get_status(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::ostree_async_progress_get_status(self.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)
}
}
fn get_uint64(&self, key: &str) -> u64 {
unsafe {
ffi::ostree_async_progress_get_uint64(self.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))
}
}
//#[cfg(any(feature = "v2017_6", feature = "dox"))]
//fn set(&self, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
// unsafe { TODO: call ffi::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();
unsafe {
ffi::ostree_async_progress_set_status(self.to_glib_none().0, status.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);
}
}
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);
}
}
#[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);
}
}
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 _)
}
}
}
unsafe extern "C" fn changed_trampoline<P>(this: *mut ffi::OstreeAsyncProgress, f: glib_ffi::gpointer)
where P: IsA<AsyncProgress> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&AsyncProgress::from_glib_borrow(this).downcast_unchecked())
}
@@ -0,0 +1,84 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ ffda6f9)
// 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::hash;
use std::mem;
use std::ptr;
glib_wrapper! {
#[derive(Debug, PartialOrd, Ord)]
pub struct CollectionRef(Boxed<ffi::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(),
}
}
impl CollectionRef {
#[cfg(any(feature = "v2018_6", feature = "dox"))]
pub fn new<'a, P: Into<Option<&'a str>>>(collection_id: P, ref_name: &str) -> CollectionRef {
let collection_id = collection_id.into();
let collection_id = collection_id.to_glib_none();
unsafe {
from_glib_full(ffi::ostree_collection_ref_new(collection_id.0, ref_name.to_glib_none().0))
}
}
#[cfg(any(feature = "v2018_6", feature = "dox"))]
pub fn dup(&self) -> Option<CollectionRef> {
unsafe {
from_glib_full(ffi::ostree_collection_ref_dup(self.to_glib_none().0))
}
}
#[cfg(any(feature = "v2018_6", feature = "dox"))]
pub fn dupv(refs: &[&CollectionRef]) -> Vec<CollectionRef> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ostree_collection_ref_dupv(refs.to_glib_none().0))
}
}
#[cfg(any(feature = "v2018_6", feature = "dox"))]
fn equal<'a, P: Into<Option<&'a CollectionRef>>>(&self, ref2: P) -> bool {
unsafe {
from_glib(ffi::ostree_collection_ref_equal(ToGlibPtr::<*mut ffi::OstreeCollectionRef>::to_glib_none(self).0 as glib_ffi::gconstpointer, ToGlibPtr::<*mut ffi::OstreeCollectionRef>::to_glib_none(ref2).0 as glib_ffi::gconstpointer))
}
}
#[cfg(any(feature = "v2018_6", feature = "dox"))]
pub fn freev(refs: &[&CollectionRef]) {
unsafe {
ffi::ostree_collection_ref_freev(refs.to_glib_full());
}
}
#[cfg(any(feature = "v2018_6", feature = "dox"))]
fn hash(&self) -> u32 {
unsafe {
ffi::ostree_collection_ref_hash(ToGlibPtr::<*mut ffi::OstreeCollectionRef>::to_glib_none(self).0 as glib_ffi::gconstpointer)
}
}
}
impl PartialEq for CollectionRef {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.equal(other)
}
}
impl Eq for CollectionRef {}
impl hash::Hash for CollectionRef {
#[inline]
fn hash<H>(&self, state: &mut H) where H: hash::Hasher {
hash::Hash::hash(&self.hash(), state)
}
}
+61
View File
@@ -0,0 +1,61 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ ffda6f9)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use ffi;
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()};
}
#[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()};
}
#[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()};
}
#[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()};
}
#[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()};
}
#[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()};
}
#[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()};
}
lazy_static! {
pub static ref DIRMETA_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ffi::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()};
}
#[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()};
}
#[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()};
}
lazy_static! {
pub static ref SUMMARY_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ffi::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()};
}
lazy_static! {
pub static ref TREE_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_TREE_GVARIANT_STRING).to_str().unwrap()};
}
#[cfg(any(feature = "v2017_4", feature = "dox"))]
lazy_static! {
pub static ref VERSION_S: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_VERSION_S).to_str().unwrap()};
}
+334
View File
@@ -0,0 +1,334 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ ffda6f9)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use ffi;
use glib::translate::*;
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
pub enum GpgSignatureFormatFlags {
GpgSignatureFormatDefault,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for GpgSignatureFormatFlags {
type GlibType = ffi::OstreeGpgSignatureFormatFlags;
fn to_glib(&self) -> ffi::OstreeGpgSignatureFormatFlags {
match *self {
GpgSignatureFormatFlags::GpgSignatureFormatDefault => ffi::OSTREE_GPG_SIGNATURE_FORMAT_DEFAULT,
GpgSignatureFormatFlags::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeGpgSignatureFormatFlags> for GpgSignatureFormatFlags {
fn from_glib(value: ffi::OstreeGpgSignatureFormatFlags) -> Self {
match value {
0 => GpgSignatureFormatFlags::GpgSignatureFormatDefault,
value => GpgSignatureFormatFlags::__Unknown(value),
}
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
pub enum ObjectType {
File,
DirTree,
DirMeta,
Commit,
TombstoneCommit,
CommitMeta,
PayloadLink,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for ObjectType {
type GlibType = ffi::OstreeObjectType;
fn to_glib(&self) -> ffi::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::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeObjectType> for ObjectType {
fn from_glib(value: ffi::OstreeObjectType) -> Self {
match value {
1 => ObjectType::File,
2 => ObjectType::DirTree,
3 => ObjectType::DirMeta,
4 => ObjectType::Commit,
5 => ObjectType::TombstoneCommit,
6 => ObjectType::CommitMeta,
7 => ObjectType::PayloadLink,
value => ObjectType::__Unknown(value),
}
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
pub enum RepoCheckoutMode {
None,
User,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for RepoCheckoutMode {
type GlibType = ffi::OstreeRepoCheckoutMode;
fn to_glib(&self) -> ffi::OstreeRepoCheckoutMode {
match *self {
RepoCheckoutMode::None => ffi::OSTREE_REPO_CHECKOUT_MODE_NONE,
RepoCheckoutMode::User => ffi::OSTREE_REPO_CHECKOUT_MODE_USER,
RepoCheckoutMode::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoCheckoutMode> for RepoCheckoutMode {
fn from_glib(value: ffi::OstreeRepoCheckoutMode) -> Self {
match value {
0 => RepoCheckoutMode::None,
1 => RepoCheckoutMode::User,
value => RepoCheckoutMode::__Unknown(value),
}
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
pub enum RepoCheckoutOverwriteMode {
None,
UnionFiles,
AddFiles,
UnionIdentical,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for RepoCheckoutOverwriteMode {
type GlibType = ffi::OstreeRepoCheckoutOverwriteMode;
fn to_glib(&self) -> ffi::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::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoCheckoutOverwriteMode> for RepoCheckoutOverwriteMode {
fn from_glib(value: ffi::OstreeRepoCheckoutOverwriteMode) -> Self {
match value {
0 => RepoCheckoutOverwriteMode::None,
1 => RepoCheckoutOverwriteMode::UnionFiles,
2 => RepoCheckoutOverwriteMode::AddFiles,
3 => RepoCheckoutOverwriteMode::UnionIdentical,
value => RepoCheckoutOverwriteMode::__Unknown(value),
}
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
pub enum RepoMode {
Bare,
Archive,
BareUser,
BareUserOnly,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for RepoMode {
type GlibType = ffi::OstreeRepoMode;
fn to_glib(&self) -> ffi::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::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoMode> for RepoMode {
fn from_glib(value: ffi::OstreeRepoMode) -> Self {
match value {
0 => RepoMode::Bare,
1 => RepoMode::Archive,
2 => RepoMode::BareUser,
3 => RepoMode::BareUserOnly,
value => RepoMode::__Unknown(value),
}
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
pub enum RepoPruneFlags {
None,
NoPrune,
RefsOnly,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for RepoPruneFlags {
type GlibType = ffi::OstreeRepoPruneFlags;
fn to_glib(&self) -> ffi::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::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoPruneFlags> for RepoPruneFlags {
fn from_glib(value: ffi::OstreeRepoPruneFlags) -> Self {
match value {
0 => RepoPruneFlags::None,
1 => RepoPruneFlags::NoPrune,
2 => RepoPruneFlags::RefsOnly,
value => RepoPruneFlags::__Unknown(value),
}
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
pub enum RepoRemoteChange {
Add,
AddIfNotExists,
Delete,
DeleteIfExists,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for RepoRemoteChange {
type GlibType = ffi::OstreeRepoRemoteChange;
fn to_glib(&self) -> ffi::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::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoRemoteChange> for RepoRemoteChange {
fn from_glib(value: ffi::OstreeRepoRemoteChange) -> Self {
match value {
0 => RepoRemoteChange::Add,
1 => RepoRemoteChange::AddIfNotExists,
2 => RepoRemoteChange::Delete,
3 => RepoRemoteChange::DeleteIfExists,
value => RepoRemoteChange::__Unknown(value),
}
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
pub enum RepoResolveRevExtFlags {
RepoResolveRevExtNone,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for RepoResolveRevExtFlags {
type GlibType = ffi::OstreeRepoResolveRevExtFlags;
fn to_glib(&self) -> ffi::OstreeRepoResolveRevExtFlags {
match *self {
RepoResolveRevExtFlags::RepoResolveRevExtNone => ffi::OSTREE_REPO_RESOLVE_REV_EXT_NONE,
RepoResolveRevExtFlags::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoResolveRevExtFlags> for RepoResolveRevExtFlags {
fn from_glib(value: ffi::OstreeRepoResolveRevExtFlags) -> Self {
match value {
0 => RepoResolveRevExtFlags::RepoResolveRevExtNone,
value => RepoResolveRevExtFlags::__Unknown(value),
}
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
pub enum StaticDeltaGenerateOpt {
Lowlatency,
Major,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for StaticDeltaGenerateOpt {
type GlibType = ffi::OstreeStaticDeltaGenerateOpt;
fn to_glib(&self) -> ffi::OstreeStaticDeltaGenerateOpt {
match *self {
StaticDeltaGenerateOpt::Lowlatency => ffi::OSTREE_STATIC_DELTA_GENERATE_OPT_LOWLATENCY,
StaticDeltaGenerateOpt::Major => ffi::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 {
match value {
0 => StaticDeltaGenerateOpt::Lowlatency,
1 => StaticDeltaGenerateOpt::Major,
value => StaticDeltaGenerateOpt::__Unknown(value),
}
}
}
+108
View File
@@ -0,0 +1,108 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ ffda6f9)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use ffi;
use glib::translate::*;
#[cfg(any(feature = "v2015_7", feature = "dox"))]
bitflags! {
pub struct RepoCommitState: u32 {
const NORMAL = 0;
const PARTIAL = 1;
}
}
#[cfg(any(feature = "v2015_7", feature = "dox"))]
#[doc(hidden)]
impl ToGlib for RepoCommitState {
type GlibType = ffi::OstreeRepoCommitState;
fn to_glib(&self) -> ffi::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 {
RepoCommitState::from_bits_truncate(value)
}
}
bitflags! {
pub struct RepoListRefsExtFlags: u32 {
const NONE = 0;
const ALIASES = 1;
const EXCLUDE_REMOTES = 2;
}
}
#[doc(hidden)]
impl ToGlib for RepoListRefsExtFlags {
type GlibType = ffi::OstreeRepoListRefsExtFlags;
fn to_glib(&self) -> ffi::OstreeRepoListRefsExtFlags {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoListRefsExtFlags> for RepoListRefsExtFlags {
fn from_glib(value: ffi::OstreeRepoListRefsExtFlags) -> RepoListRefsExtFlags {
RepoListRefsExtFlags::from_bits_truncate(value)
}
}
bitflags! {
pub struct RepoPullFlags: u32 {
const NONE = 0;
const MIRROR = 1;
const COMMIT_ONLY = 2;
const UNTRUSTED = 4;
const BAREUSERONLY_FILES = 8;
const TRUSTED_HTTP = 16;
}
}
#[doc(hidden)]
impl ToGlib for RepoPullFlags {
type GlibType = ffi::OstreeRepoPullFlags;
fn to_glib(&self) -> ffi::OstreeRepoPullFlags {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeRepoPullFlags> for RepoPullFlags {
fn from_glib(value: ffi::OstreeRepoPullFlags) -> RepoPullFlags {
RepoPullFlags::from_bits_truncate(value)
}
}
bitflags! {
pub struct SePolicyRestoreconFlags: u32 {
const NONE = 0;
const ALLOW_NOLABEL = 1;
const KEEP_EXISTING = 2;
}
}
#[doc(hidden)]
impl ToGlib for SePolicyRestoreconFlags {
type GlibType = ffi::OstreeSePolicyRestoreconFlags;
fn to_glib(&self) -> ffi::OstreeSePolicyRestoreconFlags {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::OstreeSePolicyRestoreconFlags> for SePolicyRestoreconFlags {
fn from_glib(value: ffi::OstreeSePolicyRestoreconFlags) -> SePolicyRestoreconFlags {
SePolicyRestoreconFlags::from_bits_truncate(value)
}
}
+376
View File
@@ -0,0 +1,376 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ ffda6f9)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use Error;
use ObjectType;
use ffi;
use gio;
use glib;
use glib::object::IsA;
use glib::translate::*;
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();
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);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
pub fn check_version(required_year: u32, required_release: u32) -> bool {
unsafe {
from_glib(ffi::ostree_check_version(required_year, required_release))
}
}
//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_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_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_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_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_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_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_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() }
//}
//#[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_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_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_v(csum_v: &glib::Variant) -> Option<String> {
unsafe {
from_glib_full(ffi::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_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_v(checksum: &str) -> Option<glib::Variant> {
unsafe {
from_glib_full(ffi::ostree_checksum_to_bytes_v(checksum.to_glib_none().0))
}
}
//pub fn cmd__private__() -> /*Ignored*/Option<CmdPrivateVTable> {
// unsafe { TODO: call ffi::ostree_cmd__private__() }
//}
pub fn commit_get_content_checksum(commit_variant: &glib::Variant) -> Option<String> {
unsafe {
from_glib_full(ffi::ostree_commit_get_content_checksum(commit_variant.to_glib_none().0))
}
}
pub fn commit_get_parent(commit_variant: &glib::Variant) -> Option<String> {
unsafe {
from_glib_full(ffi::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)
}
}
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();
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);
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();
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);
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();
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);
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();
unsafe {
from_glib_full(ffi::ostree_create_directory_metadata(dir_info.to_glib_none().0, xattrs.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_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_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() }
//}
//pub fn gpg_error_quark() -> /*Ignored*/glib::Quark {
// unsafe { TODO: call ffi::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 metadata_variant_type(objtype: ObjectType) -> /*Ignored*/Option<glib::VariantType> {
// unsafe { TODO: call ffi::ostree_metadata_variant_type() }
//}
pub fn object_from_string(str: &str) -> (String, 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);
(from_glib_full(out_checksum), from_glib(out_objtype))
}
}
pub fn object_name_deserialize(variant: &glib::Variant) -> (String, 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);
(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()))
}
}
pub fn object_to_string(checksum: &str, objtype: ObjectType) -> Option<String> {
unsafe {
from_glib_full(ffi::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))
}
}
pub fn object_type_to_string(objtype: ObjectType) -> Option<String> {
unsafe {
from_glib_none(ffi::ostree_object_type_to_string(objtype.to_glib()))
}
}
pub fn parse_refspec(refspec: &str) -> Result<(Option<String>, String), 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);
if error.is_null() { Ok((from_glib_full(out_remote), from_glib_full(out_ref))) } else { Err(from_glib_full(error)) }
}
}
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();
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);
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();
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);
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();
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);
if error.is_null() { Ok((from_glib_full(out_input), out_length)) } else { Err(from_glib_full(error)) }
}
}
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);
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();
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_validate_collection_id(collection_id.0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[cfg(any(feature = "v2017_8", feature = "dox"))]
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);
if error.is_null() { Ok(()) } else { Err(from_glib_full(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);
if error.is_null() { Ok(()) } else { Err(from_glib_full(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);
if error.is_null() { Ok(()) } else { Err(from_glib_full(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);
if error.is_null() { Ok(()) } else { Err(from_glib_full(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);
if error.is_null() { Ok(()) } else { Err(from_glib_full(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);
if error.is_null() { Ok(()) } else { Err(from_glib_full(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);
if error.is_null() { Ok(()) } else { Err(from_glib_full(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);
if error.is_null() { Ok(()) } else { Err(from_glib_full(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);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
@@ -0,0 +1,96 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ ffda6f9)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use Error;
use GpgSignatureFormatFlags;
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct GpgVerifyResult(Object<ffi::OstreeGpgVerifyResult>);
match fn {
get_type => || ffi::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();
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>;
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)
}
}
fn count_valid(&self) -> u32 {
unsafe {
ffi::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();
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());
}
}
//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() }
//}
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))
}
}
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));
if ret { Some(out_signature_index) } else { None }
}
}
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);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
}
+102
View File
@@ -0,0 +1,102 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ ffda6f9)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
mod async_progress;
pub use self::async_progress::AsyncProgress;
pub use self::async_progress::AsyncProgressExt;
mod gpg_verify_result;
pub use self::gpg_verify_result::GpgVerifyResult;
pub use self::gpg_verify_result::GpgVerifyResultExt;
mod mutable_tree;
pub use self::mutable_tree::MutableTree;
pub use self::mutable_tree::MutableTreeExt;
mod repo;
pub use self::repo::Repo;
pub use self::repo::RepoExt;
mod repo_file;
pub use self::repo_file::RepoFile;
pub use self::repo_file::RepoFileExt;
mod se_policy;
pub use self::se_policy::SePolicy;
pub use self::se_policy::SePolicyExt;
#[cfg(any(feature = "v2018_6", feature = "dox"))]
mod collection_ref;
#[cfg(any(feature = "v2018_6", feature = "dox"))]
pub use self::collection_ref::CollectionRef;
#[cfg(any(feature = "v2018_6", feature = "dox"))]
mod remote;
#[cfg(any(feature = "v2018_6", feature = "dox"))]
pub use self::remote::Remote;
mod repo_commit_modifier;
pub use self::repo_commit_modifier::RepoCommitModifier;
mod repo_dev_ino_cache;
pub use self::repo_dev_ino_cache::RepoDevInoCache;
mod repo_transaction_stats;
pub use self::repo_transaction_stats::RepoTransactionStats;
mod enums;
pub use self::enums::GpgSignatureFormatFlags;
pub use self::enums::ObjectType;
pub use self::enums::RepoCheckoutMode;
pub use self::enums::RepoCheckoutOverwriteMode;
pub use self::enums::RepoMode;
pub use self::enums::RepoPruneFlags;
pub use self::enums::RepoRemoteChange;
pub use self::enums::RepoResolveRevExtFlags;
pub use self::enums::StaticDeltaGenerateOpt;
mod flags;
#[cfg(any(feature = "v2015_7", feature = "dox"))]
pub use self::flags::RepoCommitState;
pub use self::flags::RepoListRefsExtFlags;
pub use self::flags::RepoPullFlags;
pub use self::flags::SePolicyRestoreconFlags;
pub mod functions;
mod constants;
pub use self::constants::COMMIT_GVARIANT_STRING;
#[cfg(any(feature = "v2018_6", feature = "dox"))]
pub use self::constants::COMMIT_META_KEY_COLLECTION_BINDING;
#[cfg(any(feature = "v2017_7", feature = "dox"))]
pub use self::constants::COMMIT_META_KEY_ENDOFLIFE;
#[cfg(any(feature = "v2017_7", feature = "dox"))]
pub use self::constants::COMMIT_META_KEY_ENDOFLIFE_REBASE;
#[cfg(any(feature = "v2017_9", feature = "dox"))]
pub use self::constants::COMMIT_META_KEY_REF_BINDING;
#[cfg(any(feature = "v2017_13", feature = "dox"))]
pub use self::constants::COMMIT_META_KEY_SOURCE_TITLE;
#[cfg(any(feature = "v2014_9", feature = "dox"))]
pub use self::constants::COMMIT_META_KEY_VERSION;
pub use self::constants::DIRMETA_GVARIANT_STRING;
pub use self::constants::FILEMETA_GVARIANT_STRING;
#[cfg(any(feature = "v2018_3", feature = "dox"))]
pub use self::constants::ORIGIN_TRANSIENT_GROUP;
#[cfg(any(feature = "v2018_6", feature = "dox"))]
pub use self::constants::REPO_METADATA_REF;
pub use self::constants::SUMMARY_GVARIANT_STRING;
pub use self::constants::SUMMARY_SIG_GVARIANT_STRING;
pub use self::constants::TREE_GVARIANT_STRING;
#[cfg(any(feature = "v2017_4", feature = "dox"))]
pub use self::constants::VERSION_S;
#[doc(hidden)]
pub mod traits {
pub use super::AsyncProgressExt;
pub use super::GpgVerifyResultExt;
pub use super::MutableTreeExt;
pub use super::RepoExt;
pub use super::RepoFileExt;
pub use super::SePolicyExt;
}
+142
View File
@@ -0,0 +1,142 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ ffda6f9)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use Error;
use Repo;
use ffi;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct MutableTree(Object<ffi::OstreeMutableTree, ffi::OstreeMutableTreeClass>);
match fn {
get_type => || ffi::ostree_mutable_tree_get_type(),
}
}
impl MutableTree {
pub fn new() -> MutableTree {
unsafe {
from_glib_full(ffi::ostree_mutable_tree_new())
}
}
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))
}
}
}
impl Default for MutableTree {
fn default() -> Self {
Self::new()
}
}
pub trait MutableTreeExt {
#[cfg(any(feature = "v2018_7", feature = "dox"))]
fn check_error(&self) -> Result<(), Error>;
fn ensure_dir(&self, name: &str) -> Result<MutableTree, Error>;
//fn ensure_parent_dirs(&self, split_path: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 0, id: 28 }, metadata_checksum: &str) -> Result<MutableTree, Error>;
fn fill_empty_from_dirtree(&self, repo: &Repo, contents_checksum: &str, metadata_checksum: &str) -> bool;
fn get_contents_checksum(&self) -> Option<String>;
//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_subdirs(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 1, id: 37 };
fn replace_file(&self, name: &str, checksum: &str) -> Result<(), Error>;
fn set_contents_checksum(&self, checksum: &str);
fn set_metadata_checksum(&self, checksum: &str);
//fn walk(&self, split_path: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 0, id: 28 }, start: u32) -> Result<MutableTree, Error>;
}
impl<O: IsA<MutableTree>> MutableTreeExt for O {
#[cfg(any(feature = "v2018_7", feature = "dox"))]
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);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
fn ensure_dir(&self, name: &str) -> Result<MutableTree, Error> {
unsafe {
let mut out_subdir = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ffi::ostree_mutable_tree_ensure_dir(self.to_glib_none().0, name.to_glib_none().0, &mut out_subdir, &mut error);
if error.is_null() { Ok(from_glib_full(out_subdir)) } else { Err(from_glib_full(error)) }
}
}
//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() }
//}
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))
}
}
fn get_contents_checksum(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::ostree_mutable_tree_get_contents_checksum(self.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() }
//}
fn get_metadata_checksum(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::ostree_mutable_tree_get_metadata_checksum(self.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() }
//}
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);
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);
}
}
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);
}
}
//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() }
//}
}
+37
View File
@@ -0,0 +1,37 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ ffda6f9)
// 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;
glib_wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Remote(Shared<ffi::OstreeRemote>);
match fn {
ref => |ptr| ffi::ostree_remote_ref(ptr),
unref => |ptr| ffi::ostree_remote_unref(ptr),
get_type => || ffi::ostree_remote_get_type(),
}
}
impl Remote {
#[cfg(any(feature = "v2018_6", feature = "dox"))]
pub fn get_name(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::ostree_remote_get_name(self.to_glib_none().0))
}
}
#[cfg(any(feature = "v2018_6", feature = "dox"))]
pub fn get_url(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::ostree_remote_get_url(self.to_glib_none().0))
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,49 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ ffda6f9)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#[cfg(any(feature = "v2017_13", feature = "dox"))]
use RepoDevInoCache;
use SePolicy;
use ffi;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct RepoCommitModifier(Shared<ffi::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(),
}
}
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() }
//}
#[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);
}
}
pub fn set_sepolicy<'a, P: Into<Option<&'a SePolicy>>>(&self, sepolicy: P) {
let sepolicy = sepolicy.into();
let sepolicy = sepolicy.to_glib_none();
unsafe {
ffi::ostree_repo_commit_modifier_set_sepolicy(self.to_glib_none().0, sepolicy.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() }
//}
}
@@ -0,0 +1,35 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ ffda6f9)
// 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;
glib_wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct RepoDevInoCache(Shared<ffi::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(),
}
}
impl RepoDevInoCache {
pub fn new() -> RepoDevInoCache {
unsafe {
from_glib_full(ffi::ostree_repo_devino_cache_new())
}
}
}
impl Default for RepoDevInoCache {
fn default() -> Self {
Self::new()
}
}
+104
View File
@@ -0,0 +1,104 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ ffda6f9)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use Error;
use Repo;
use ffi;
use gio;
use gio_ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct RepoFile(Object<ffi::OstreeRepoFile, ffi::OstreeRepoFileClass>): [
gio::File => gio_ffi::GFile,
];
match fn {
get_type => || ffi::ostree_repo_file_get_type(),
}
}
pub trait RepoFileExt {
fn ensure_resolved(&self) -> Result<(), Error>;
fn get_checksum(&self) -> Option<String>;
fn get_repo(&self) -> Option<Repo>;
fn get_root(&self) -> Option<RepoFile>;
fn tree_get_contents(&self) -> Option<glib::Variant>;
fn tree_get_contents_checksum(&self) -> Option<String>;
fn tree_get_metadata(&self) -> Option<glib::Variant>;
fn tree_get_metadata_checksum(&self) -> Option<String>;
fn tree_set_metadata(&self, checksum: &str, metadata: &glib::Variant);
}
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);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
fn get_checksum(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::ostree_repo_file_get_checksum(self.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))
}
}
fn get_root(&self) -> Option<RepoFile> {
unsafe {
from_glib_none(ffi::ostree_repo_file_get_root(self.to_glib_none().0))
}
}
fn tree_get_contents(&self) -> Option<glib::Variant> {
unsafe {
from_glib_full(ffi::ostree_repo_file_tree_get_contents(self.to_glib_none().0))
}
}
fn tree_get_contents_checksum(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::ostree_repo_file_tree_get_contents_checksum(self.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))
}
}
fn tree_get_metadata_checksum(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::ostree_repo_file_tree_get_metadata_checksum(self.to_glib_none().0))
}
}
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);
}
}
}
@@ -0,0 +1,21 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ ffda6f9)
// 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;
glib_wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct RepoTransactionStats(Boxed<ffi::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(),
}
}
+127
View File
@@ -0,0 +1,127 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ ffda6f9)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use Error;
use SePolicyRestoreconFlags;
use ffi;
use gio;
use glib;
use glib::StaticType;
use glib::Value;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct SePolicy(Object<ffi::OstreeSePolicy>);
match fn {
get_type => || ffi::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();
unsafe {
let mut error = ptr::null_mut();
let ret = ffi::ostree_sepolicy_new(path.to_glib_none().0, cancellable.0, &mut error);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
}
}
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();
unsafe {
let mut error = ptr::null_mut();
let ret = ffi::ostree_sepolicy_new_at(rootfs_dfd, cancellable.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 {
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 {
fn get_csum(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::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();
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);
if error.is_null() { Ok(from_glib_full(out_label)) } else { Err(from_glib_full(error)) }
}
}
fn get_name(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::ostree_sepolicy_get_name(self.to_glib_none().0))
}
}
fn get_path(&self) -> Option<gio::File> {
unsafe {
from_glib_none(ffi::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();
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);
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> {
unsafe {
let mut error = ptr::null_mut();
let _ = ffi::ostree_sepolicy_setfscreatecon(self.to_glib_none().0, path.to_glib_none().0, mode, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
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);
value.get().unwrap()
}
}
}