diff --git a/rust-bindings/rust/conf/ostree.toml b/rust-bindings/rust/conf/ostree.toml index d2159541..e54a88e4 100644 --- a/rust-bindings/rust/conf/ostree.toml +++ b/rust-bindings/rust/conf/ostree.toml @@ -13,8 +13,12 @@ girs_dir = "../gir-files" generate = [ "OSTree.AsyncProgress", "OSTree.BootconfigParser", + "OSTree.ChecksumFlags", "OSTree.Deployment", "OSTree.DeploymentUnlockedState", + "OSTree.DiffFlags", + "OSTree.DiffItem", + "OSTree.GpgSignatureAttr", "OSTree.GpgSignatureFormatFlags", "OSTree.GpgVerifyResult", "OSTree.MutableTree", @@ -26,6 +30,7 @@ generate = [ "OSTree.RepoCommitState", "OSTree.RepoDevInoCache", "OSTree.RepoFile", + "OSTree.RepoFinder", "OSTree.RepoListRefsExtFlags", "OSTree.RepoMode", "OSTree.RepoPruneFlags", @@ -87,8 +92,19 @@ manual_traits = ["RepoExtManual"] ignore = true [[object.function]] - # issue with the return type of content (thinks guchar** is u8) - name = "write_content_async" + # these async functions generate bad code for different reasons + pattern = "write_content_async|pull_from_remotes_async|find_remotes_async" + ignore = true + +[[object]] +name = "OSTree.RepoFinderResult" +status = "generate" + [[object.function]] + name = "freev" + ignore = true + + [[object.function]] + name = "dup" ignore = true [[object]] diff --git a/rust-bindings/rust/src/auto/diff_item.rs b/rust-bindings/rust/src/auto/diff_item.rs new file mode 100644 index 00000000..5e791897 --- /dev/null +++ b/rust-bindings/rust/src/auto/diff_item.rs @@ -0,0 +1,17 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::translate::*; +use ostree_sys; + +glib_wrapper! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct DiffItem(Shared); + + match fn { + ref => |ptr| ostree_sys::ostree_diff_item_ref(ptr), + unref => |ptr| ostree_sys::ostree_diff_item_unref(ptr), + get_type => || ostree_sys::ostree_diff_item_get_type(), + } +} diff --git a/rust-bindings/rust/src/auto/enums.rs b/rust-bindings/rust/src/auto/enums.rs index b62f254a..14825326 100644 --- a/rust-bindings/rust/src/auto/enums.rs +++ b/rust-bindings/rust/src/auto/enums.rs @@ -53,6 +53,93 @@ impl FromGlib for DeploymentUnlockedS } } +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] +pub enum GpgSignatureAttr { + Valid, + SigExpired, + KeyExpired, + KeyRevoked, + KeyMissing, + Fingerprint, + Timestamp, + ExpTimestamp, + PubkeyAlgoName, + HashAlgoName, + UserName, + UserEmail, + FingerprintPrimary, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for GpgSignatureAttr { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "GpgSignatureAttr::{}", match *self { + GpgSignatureAttr::Valid => "Valid", + GpgSignatureAttr::SigExpired => "SigExpired", + GpgSignatureAttr::KeyExpired => "KeyExpired", + GpgSignatureAttr::KeyRevoked => "KeyRevoked", + GpgSignatureAttr::KeyMissing => "KeyMissing", + GpgSignatureAttr::Fingerprint => "Fingerprint", + GpgSignatureAttr::Timestamp => "Timestamp", + GpgSignatureAttr::ExpTimestamp => "ExpTimestamp", + GpgSignatureAttr::PubkeyAlgoName => "PubkeyAlgoName", + GpgSignatureAttr::HashAlgoName => "HashAlgoName", + GpgSignatureAttr::UserName => "UserName", + GpgSignatureAttr::UserEmail => "UserEmail", + GpgSignatureAttr::FingerprintPrimary => "FingerprintPrimary", + _ => "Unknown", + }) + } +} + +#[doc(hidden)] +impl ToGlib for GpgSignatureAttr { + type GlibType = ostree_sys::OstreeGpgSignatureAttr; + + fn to_glib(&self) -> ostree_sys::OstreeGpgSignatureAttr { + match *self { + GpgSignatureAttr::Valid => ostree_sys::OSTREE_GPG_SIGNATURE_ATTR_VALID, + GpgSignatureAttr::SigExpired => ostree_sys::OSTREE_GPG_SIGNATURE_ATTR_SIG_EXPIRED, + GpgSignatureAttr::KeyExpired => ostree_sys::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXPIRED, + GpgSignatureAttr::KeyRevoked => ostree_sys::OSTREE_GPG_SIGNATURE_ATTR_KEY_REVOKED, + GpgSignatureAttr::KeyMissing => ostree_sys::OSTREE_GPG_SIGNATURE_ATTR_KEY_MISSING, + GpgSignatureAttr::Fingerprint => ostree_sys::OSTREE_GPG_SIGNATURE_ATTR_FINGERPRINT, + GpgSignatureAttr::Timestamp => ostree_sys::OSTREE_GPG_SIGNATURE_ATTR_TIMESTAMP, + GpgSignatureAttr::ExpTimestamp => ostree_sys::OSTREE_GPG_SIGNATURE_ATTR_EXP_TIMESTAMP, + GpgSignatureAttr::PubkeyAlgoName => ostree_sys::OSTREE_GPG_SIGNATURE_ATTR_PUBKEY_ALGO_NAME, + GpgSignatureAttr::HashAlgoName => ostree_sys::OSTREE_GPG_SIGNATURE_ATTR_HASH_ALGO_NAME, + GpgSignatureAttr::UserName => ostree_sys::OSTREE_GPG_SIGNATURE_ATTR_USER_NAME, + GpgSignatureAttr::UserEmail => ostree_sys::OSTREE_GPG_SIGNATURE_ATTR_USER_EMAIL, + GpgSignatureAttr::FingerprintPrimary => ostree_sys::OSTREE_GPG_SIGNATURE_ATTR_FINGERPRINT_PRIMARY, + GpgSignatureAttr::__Unknown(value) => value + } + } +} + +#[doc(hidden)] +impl FromGlib for GpgSignatureAttr { + fn from_glib(value: ostree_sys::OstreeGpgSignatureAttr) -> Self { + match value { + 0 => GpgSignatureAttr::Valid, + 1 => GpgSignatureAttr::SigExpired, + 2 => GpgSignatureAttr::KeyExpired, + 3 => GpgSignatureAttr::KeyRevoked, + 4 => GpgSignatureAttr::KeyMissing, + 5 => GpgSignatureAttr::Fingerprint, + 6 => GpgSignatureAttr::Timestamp, + 7 => GpgSignatureAttr::ExpTimestamp, + 8 => GpgSignatureAttr::PubkeyAlgoName, + 9 => GpgSignatureAttr::HashAlgoName, + 10 => GpgSignatureAttr::UserName, + 11 => GpgSignatureAttr::UserEmail, + 12 => GpgSignatureAttr::FingerprintPrimary, + value => GpgSignatureAttr::__Unknown(value), + } + } +} + #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] #[derive(Clone, Copy)] pub enum GpgSignatureFormatFlags { diff --git a/rust-bindings/rust/src/auto/flags.rs b/rust-bindings/rust/src/auto/flags.rs index 74541aa8..48aca676 100644 --- a/rust-bindings/rust/src/auto/flags.rs +++ b/rust-bindings/rust/src/auto/flags.rs @@ -12,6 +12,55 @@ use glib::value::Value; use gobject_sys; use ostree_sys; +#[cfg(any(feature = "v2017_13", feature = "dox"))] +bitflags! { + pub struct ChecksumFlags: u32 { + const NONE = 0; + const IGNORE_XATTRS = 1; + } +} + +#[cfg(any(feature = "v2017_13", feature = "dox"))] +#[doc(hidden)] +impl ToGlib for ChecksumFlags { + type GlibType = ostree_sys::OstreeChecksumFlags; + + fn to_glib(&self) -> ostree_sys::OstreeChecksumFlags { + self.bits() + } +} + +#[cfg(any(feature = "v2017_13", feature = "dox"))] +#[doc(hidden)] +impl FromGlib for ChecksumFlags { + fn from_glib(value: ostree_sys::OstreeChecksumFlags) -> ChecksumFlags { + ChecksumFlags::from_bits_truncate(value) + } +} + +bitflags! { + pub struct DiffFlags: u32 { + const NONE = 0; + const IGNORE_XATTRS = 1; + } +} + +#[doc(hidden)] +impl ToGlib for DiffFlags { + type GlibType = ostree_sys::OstreeDiffFlags; + + fn to_glib(&self) -> ostree_sys::OstreeDiffFlags { + self.bits() + } +} + +#[doc(hidden)] +impl FromGlib for DiffFlags { + fn from_glib(value: ostree_sys::OstreeDiffFlags) -> DiffFlags { + DiffFlags::from_bits_truncate(value) + } +} + #[cfg(any(feature = "v2015_7", feature = "dox"))] bitflags! { pub struct RepoCommitState: u32 { diff --git a/rust-bindings/rust/src/auto/functions.rs b/rust-bindings/rust/src/auto/functions.rs index 968131a2..fe780ad6 100644 --- a/rust-bindings/rust/src/auto/functions.rs +++ b/rust-bindings/rust/src/auto/functions.rs @@ -65,7 +65,7 @@ pub fn check_version(required_year: u32, required_release: u32) -> bool { //} //#[cfg(any(feature = "v2017_13", feature = "dox"))] -//pub fn checksum_file_at>(dfd: i32, path: &str, stbuf: /*Unimplemented*/Option, objtype: ObjectType, flags: /*Ignored*/ChecksumFlags, out_checksum: &str, cancellable: Option<&P>) -> Result<(), Error> { +//pub fn checksum_file_at>(dfd: i32, path: &str, stbuf: /*Unimplemented*/Option, objtype: ObjectType, flags: ChecksumFlags, out_checksum: &str, cancellable: Option<&P>) -> Result<(), Error> { // unsafe { TODO: call ostree_sys:ostree_checksum_file_at() } //} @@ -159,12 +159,12 @@ pub fn create_directory_metadata(dir_info: &gio::FileInfo, xattrs: Option<&glib: } } -//pub fn diff_dirs, Q: IsA, R: IsA>(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> { +//pub fn diff_dirs, Q: IsA, R: IsA>(flags: 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, Q: IsA, R: IsA>(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> { +//pub fn diff_dirs_with_options, Q: IsA, R: IsA>(flags: 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() } //} diff --git a/rust-bindings/rust/src/auto/gpg_verifier.rs b/rust-bindings/rust/src/auto/gpg_verifier.rs new file mode 100644 index 00000000..5666ff18 --- /dev/null +++ b/rust-bindings/rust/src/auto/gpg_verifier.rs @@ -0,0 +1,5 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use ostree_sys; diff --git a/rust-bindings/rust/src/auto/mod.rs b/rust-bindings/rust/src/auto/mod.rs index 5db35766..887d3259 100644 --- a/rust-bindings/rust/src/auto/mod.rs +++ b/rust-bindings/rust/src/auto/mod.rs @@ -26,6 +26,10 @@ mod repo_file; pub use self::repo_file::{RepoFile, RepoFileClass, NONE_REPO_FILE}; pub use self::repo_file::RepoFileExt; +mod repo_finder; +pub use self::repo_finder::{RepoFinder, NONE_REPO_FINDER}; +pub use self::repo_finder::RepoFinderExt; + mod se_policy; pub use self::se_policy::{SePolicy, SePolicyClass}; @@ -40,6 +44,9 @@ mod collection_ref; #[cfg(any(feature = "v2018_6", feature = "dox"))] pub use self::collection_ref::CollectionRef; +mod diff_item; +pub use self::diff_item::DiffItem; + #[cfg(any(feature = "v2018_6", feature = "dox"))] mod remote; #[cfg(any(feature = "v2018_6", feature = "dox"))] @@ -51,11 +58,17 @@ pub use self::repo_commit_modifier::RepoCommitModifier; mod repo_dev_ino_cache; pub use self::repo_dev_ino_cache::RepoDevInoCache; +#[cfg(any(feature = "v2018_6", feature = "dox"))] +mod repo_finder_result; +#[cfg(any(feature = "v2018_6", feature = "dox"))] +pub use self::repo_finder_result::RepoFinderResult; + mod repo_transaction_stats; pub use self::repo_transaction_stats::RepoTransactionStats; mod enums; pub use self::enums::DeploymentUnlockedState; +pub use self::enums::GpgSignatureAttr; pub use self::enums::GpgSignatureFormatFlags; pub use self::enums::ObjectType; pub use self::enums::RepoCheckoutMode; @@ -66,6 +79,9 @@ pub use self::enums::RepoRemoteChange; pub use self::enums::StaticDeltaGenerateOpt; mod flags; +#[cfg(any(feature = "v2017_13", feature = "dox"))] +pub use self::flags::ChecksumFlags; +pub use self::flags::DiffFlags; #[cfg(any(feature = "v2015_7", feature = "dox"))] pub use self::flags::RepoCommitState; pub use self::flags::RepoListRefsExtFlags; @@ -109,4 +125,5 @@ pub mod traits { pub use super::AsyncProgressExt; pub use super::MutableTreeExt; pub use super::RepoFileExt; + pub use super::RepoFinderExt; } diff --git a/rust-bindings/rust/src/auto/mutable_tree_iter.rs b/rust-bindings/rust/src/auto/mutable_tree_iter.rs new file mode 100644 index 00000000..5666ff18 --- /dev/null +++ b/rust-bindings/rust/src/auto/mutable_tree_iter.rs @@ -0,0 +1,5 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use ostree_sys; diff --git a/rust-bindings/rust/src/auto/repo.rs b/rust-bindings/rust/src/auto/repo.rs index 7a6f96ca..dfe9f3e4 100644 --- a/rust-bindings/rust/src/auto/repo.rs +++ b/rust-bindings/rust/src/auto/repo.rs @@ -163,39 +163,6 @@ impl Repo { // unsafe { TODO: call ostree_sys:ostree_repo_export_tree_to_archive() } //} - //#[cfg(any(feature = "v2018_6", feature = "dox"))] - //pub fn find_remotes_async, Q: IsA, R: FnOnce(Result, Error>) + Send + 'static>(&self, refs: &[&CollectionRef], options: Option<&glib::Variant>, finders: /*Ignored*/&[RepoFinder], progress: Option<&P>, cancellable: Option<&Q>, callback: R) { - // unsafe { TODO: call ostree_sys:ostree_repo_find_remotes_async() } - //} - - //#[cfg(feature = "futures")] - //#[cfg(any(feature = "v2018_6", feature = "dox"))] - //pub fn find_remotes_async_future + Clone + 'static>(&self, refs: &[&CollectionRef], options: Option<&glib::Variant>, finders: /*Ignored*/&[RepoFinder], progress: Option<&P>) -> Box_, Error>> + std::marker::Unpin> { - //use gio::GioFuture; - //use fragile::Fragile; - - //let refs = refs.clone(); - //let options = options.map(ToOwned::to_owned); - //let finders = finders.clone(); - //let progress = progress.map(ToOwned::to_owned); - //GioFuture::new(self, move |obj, send| { - // let cancellable = gio::Cancellable::new(); - // let send = Fragile::new(send); - // obj.find_remotes_async( - // &refs, - // options.as_ref().map(::std::borrow::Borrow::borrow), - // &finders, - // progress.as_ref().map(::std::borrow::Borrow::borrow), - // Some(&cancellable), - // move |res| { - // let _ = send.into_inner().send(res); - // }, - // ); - - // cancellable - //}) - //} - #[cfg(any(feature = "v2017_15", feature = "dox"))] pub fn fsck_object>(&self, objtype: ObjectType, sha256: &str, cancellable: Option<&P>) -> Result<(), Error> { unsafe { @@ -497,37 +464,6 @@ impl Repo { } } - //#[cfg(any(feature = "v2018_6", feature = "dox"))] - //pub fn pull_from_remotes_async, Q: IsA, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, results: /*Ignored*/&[&RepoFinderResult], options: Option<&glib::Variant>, progress: Option<&P>, cancellable: Option<&Q>, callback: R) { - // unsafe { TODO: call ostree_sys:ostree_repo_pull_from_remotes_async() } - //} - - //#[cfg(feature = "futures")] - //#[cfg(any(feature = "v2018_6", feature = "dox"))] - //pub fn pull_from_remotes_async_future + Clone + 'static>(&self, results: /*Ignored*/&[&RepoFinderResult], options: Option<&glib::Variant>, progress: Option<&P>) -> Box_> + std::marker::Unpin> { - //use gio::GioFuture; - //use fragile::Fragile; - - //let results = results.clone(); - //let options = options.map(ToOwned::to_owned); - //let progress = progress.map(ToOwned::to_owned); - //GioFuture::new(self, move |obj, send| { - // let cancellable = gio::Cancellable::new(); - // let send = Fragile::new(send); - // obj.pull_from_remotes_async( - // &results, - // options.as_ref().map(::std::borrow::Borrow::borrow), - // progress.as_ref().map(::std::borrow::Borrow::borrow), - // Some(&cancellable), - // move |res| { - // let _ = send.into_inner().send(res); - // }, - // ); - - // cancellable - //}) - //} - pub fn pull_one_dir, Q: IsA>(&self, remote_name: &str, dir_to_pull: &str, refs_to_fetch: &[&str], flags: RepoPullFlags, progress: Option<&P>, cancellable: Option<&Q>) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); diff --git a/rust-bindings/rust/src/auto/repo_finder.rs b/rust-bindings/rust/src/auto/repo_finder.rs new file mode 100644 index 00000000..f8796716 --- /dev/null +++ b/rust-bindings/rust/src/auto/repo_finder.rs @@ -0,0 +1,97 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::object::IsA; +use glib::translate::*; +use ostree_sys; +use std::fmt; + +glib_wrapper! { + pub struct RepoFinder(Interface); + + match fn { + get_type => || ostree_sys::ostree_repo_finder_get_type(), + } +} + +impl RepoFinder { + //#[cfg(any(feature = "v2018_6", feature = "dox"))] + //pub fn resolve_all_async, Q: FnOnce(Result) + Send + 'static>(finders: &[RepoFinder], refs: &[&CollectionRef], parent_repo: &Repo, cancellable: Option<&P>, callback: Q) { + // unsafe { TODO: call ostree_sys:ostree_repo_finder_resolve_all_async() } + //} + + //#[cfg(feature = "futures")] + //#[cfg(any(feature = "v2018_6", feature = "dox"))] + //pub fn resolve_all_async_future(finders: &[RepoFinder], refs: &[&CollectionRef], parent_repo: &Repo) -> Box_> + std::marker::Unpin> { + //use gio::GioFuture; + //use fragile::Fragile; + + //let finders = finders.clone(); + //let refs = refs.clone(); + //let parent_repo = parent_repo.clone(); + //GioFuture::new(&(), move |_obj, send| { + // let cancellable = gio::Cancellable::new(); + // let send = Fragile::new(send); + // Self::resolve_all_async( + // &finders, + // &refs, + // &parent_repo, + // Some(&cancellable), + // move |res| { + // let _ = send.into_inner().send(res); + // }, + // ); + + // cancellable + //}) + //} +} + +pub const NONE_REPO_FINDER: Option<&RepoFinder> = None; + +pub trait RepoFinderExt: 'static { + //#[cfg(any(feature = "v2018_6", feature = "dox"))] + //fn resolve_async, Q: FnOnce(Result) + Send + 'static>(&self, refs: &[&CollectionRef], parent_repo: &Repo, cancellable: Option<&P>, callback: Q); + + //#[cfg(feature = "futures")] + //#[cfg(any(feature = "v2018_6", feature = "dox"))] + //fn resolve_async_future(&self, refs: &[&CollectionRef], parent_repo: &Repo) -> Box_> + std::marker::Unpin>; +} + +impl> RepoFinderExt for O { + //#[cfg(any(feature = "v2018_6", feature = "dox"))] + //fn resolve_async, Q: FnOnce(Result) + Send + 'static>(&self, refs: &[&CollectionRef], parent_repo: &Repo, cancellable: Option<&P>, callback: Q) { + // unsafe { TODO: call ostree_sys:ostree_repo_finder_resolve_async() } + //} + + //#[cfg(feature = "futures")] + //#[cfg(any(feature = "v2018_6", feature = "dox"))] + //fn resolve_async_future(&self, refs: &[&CollectionRef], parent_repo: &Repo) -> Box_> + std::marker::Unpin> { + //use gio::GioFuture; + //use fragile::Fragile; + + //let refs = refs.clone(); + //let parent_repo = parent_repo.clone(); + //GioFuture::new(self, move |obj, send| { + // let cancellable = gio::Cancellable::new(); + // let send = Fragile::new(send); + // obj.resolve_async( + // &refs, + // &parent_repo, + // Some(&cancellable), + // move |res| { + // let _ = send.into_inner().send(res); + // }, + // ); + + // cancellable + //}) + //} +} + +impl fmt::Display for RepoFinder { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "RepoFinder") + } +} diff --git a/rust-bindings/rust/src/auto/repo_finder_result.rs b/rust-bindings/rust/src/auto/repo_finder_result.rs new file mode 100644 index 00000000..e8ece65a --- /dev/null +++ b/rust-bindings/rust/src/auto/repo_finder_result.rs @@ -0,0 +1,57 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +#[cfg(any(feature = "v2018_6", feature = "dox"))] +use glib::translate::*; +use gobject_sys; +use ostree_sys; +use std::cmp; + +glib_wrapper! { + #[derive(Debug, Hash)] + pub struct RepoFinderResult(Boxed); + + match fn { + copy => |ptr| gobject_sys::g_boxed_copy(ostree_sys::ostree_repo_finder_result_get_type(), ptr as *mut _) as *mut ostree_sys::OstreeRepoFinderResult, + free => |ptr| gobject_sys::g_boxed_free(ostree_sys::ostree_repo_finder_result_get_type(), ptr as *mut _), + get_type => || ostree_sys::ostree_repo_finder_result_get_type(), + } +} + +impl RepoFinderResult { + //#[cfg(any(feature = "v2018_6", feature = "dox"))] + //pub fn new>(remote: &Remote, finder: &P, priority: i32, ref_to_checksum: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 28 }, ref_to_timestamp: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 9 }, summary_last_modified: u64) -> RepoFinderResult { + // unsafe { TODO: call ostree_sys:ostree_repo_finder_result_new() } + //} + + #[cfg(any(feature = "v2018_6", feature = "dox"))] + fn compare(&self, b: &RepoFinderResult) -> i32 { + unsafe { + ostree_sys::ostree_repo_finder_result_compare(self.to_glib_none().0, b.to_glib_none().0) + } + } +} + +impl PartialEq for RepoFinderResult { + #[inline] + fn eq(&self, other: &Self) -> bool { + self.compare(other) == 0 + } +} + +impl Eq for RepoFinderResult {} + +impl PartialOrd for RepoFinderResult { + #[inline] + fn partial_cmp(&self, other: &Self) -> Option { + self.compare(other).partial_cmp(&0) + } +} + +impl Ord for RepoFinderResult { + #[inline] + fn cmp(&self, other: &Self) -> cmp::Ordering { + self.compare(other).cmp(&0) + } +}