diff --git a/rust-bindings/rust/conf/ostree.toml b/rust-bindings/rust/conf/ostree.toml index ca6a5582..b7c0347b 100644 --- a/rust-bindings/rust/conf/ostree.toml +++ b/rust-bindings/rust/conf/ostree.toml @@ -22,6 +22,7 @@ generate = [ "OSTree.RepoCommitModifier", "OSTree.RepoCommitState", "OSTree.RepoDevInoCache", + "OSTree.RepoFile", "OSTree.RepoListRefsExtFlags", "OSTree.RepoMode", "OSTree.RepoPruneFlags", @@ -78,21 +79,6 @@ status = "generate" pattern = ".+_async" ignore = true -[[object]] -name = "OSTree.RepoFile" -status = "generate" - [[object.function]] - pattern = "get_xattrs" - ignore = true - - [[object.function]] - pattern = "tree_find_child" - ignore = true - - [[object.function]] - pattern = "tree_query_child" - ignore = true - [[object]] name = "OSTree.*" status = "generate" diff --git a/rust-bindings/rust/gir-files/OSTree-1.0.gir b/rust-bindings/rust/gir-files/OSTree-1.0.gir index 53f62efe..2ef66686 100644 --- a/rust-bindings/rust/gir-files/OSTree-1.0.gir +++ b/rust-bindings/rust/gir-files/OSTree-1.0.gir @@ -8049,15 +8049,23 @@ options. This is used by ostree_repo_export_tree_to_archive(). + #OstreeRepoFile - + + the extended attributes + Cancellable @@ -8069,15 +8077,23 @@ options. This is used by ostree_repo_export_tree_to_archive(). + #OstreeRepoFile + name of the child - + - + @@ -8134,6 +8150,7 @@ options. This is used by ostree_repo_export_tree_to_archive(). + #OstreeRepoFile @@ -8145,13 +8162,17 @@ options. This is used by ostree_repo_export_tree_to_archive(). - + + Cancellable diff --git a/rust-bindings/rust/src/auto/repo_file.rs b/rust-bindings/rust/src/auto/repo_file.rs index bdfc9796..500023fe 100644 --- a/rust-bindings/rust/src/auto/repo_file.rs +++ b/rust-bindings/rust/src/auto/repo_file.rs @@ -34,6 +34,10 @@ pub trait RepoFileExt { fn get_root(&self) -> Option; + fn get_xattrs<'a, P: Into>>(&self, cancellable: P) -> Result; + + fn tree_find_child(&self, name: &str) -> (i32, bool, glib::Variant); + fn tree_get_contents(&self) -> Option; fn tree_get_contents_checksum(&self) -> Option; @@ -42,6 +46,8 @@ pub trait RepoFileExt { fn tree_get_metadata_checksum(&self) -> Option; + fn tree_query_child<'a, P: Into>>(&self, n: i32, attributes: &str, flags: gio::FileQueryInfoFlags, cancellable: P) -> Result; + fn tree_set_metadata(&self, checksum: &str, metadata: &glib::Variant); } @@ -72,6 +78,26 @@ impl> RepoFileExt for O { } } + fn get_xattrs<'a, P: Into>>(&self, cancellable: P) -> Result { + let cancellable = cancellable.into(); + let cancellable = cancellable.to_glib_none(); + 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); + if error.is_null() { Ok(from_glib_full(out_xattrs)) } else { Err(from_glib_full(error)) } + } + } + + fn tree_find_child(&self, name: &str) -> (i32, bool, glib::Variant) { + 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); + (ret, from_glib(is_dir), from_glib_full(out_container)) + } + } + fn tree_get_contents(&self) -> Option { unsafe { from_glib_full(ffi::ostree_repo_file_tree_get_contents(self.to_glib_none().0)) @@ -96,6 +122,17 @@ impl> RepoFileExt for O { } } + fn tree_query_child<'a, P: Into>>(&self, n: i32, attributes: &str, flags: gio::FileQueryInfoFlags, cancellable: P) -> Result { + let cancellable = cancellable.into(); + let cancellable = cancellable.to_glib_none(); + 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); + 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);