src: add CommitSizesEntry

This commit is contained in:
Felix Krull authored and Colin Walters committed 2022-05-06 12:53:56 -04:00
1 parent 3d8d5ce53e
commit 5b1bc50418
10 files changed
+134 -24

No files matched your search

@@ -0,0 +1,29 @@
// 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 = "v2020_1", feature = "dox"))]
use glib::translate::*;
use ostree_sys;
#[cfg(any(feature = "v2020_1", feature = "dox"))]
use ObjectType;
glib_wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct CommitSizesEntry(Boxed<ostree_sys::OstreeCommitSizesEntry>);
match fn {
copy => |ptr| ostree_sys::ostree_commit_sizes_entry_copy(mut_override(ptr)),
free => |ptr| ostree_sys::ostree_commit_sizes_entry_free(ptr),
get_type => || ostree_sys::ostree_commit_sizes_entry_get_type(),
}
}
impl CommitSizesEntry {
#[cfg(any(feature = "v2020_1", feature = "dox"))]
pub fn new(checksum: &str, objtype: ObjectType, unpacked: u64, archived: u64) -> Option<CommitSizesEntry> {
unsafe {
from_glib_full(ostree_sys::ostree_commit_sizes_entry_new(checksum.to_glib_none().0, objtype.to_glib(), unpacked, archived))
}
}
}
+11 -4
View File
@@ -10,6 +10,8 @@ use glib::GString;
use ostree_sys;
use std::mem;
use std::ptr;
#[cfg(any(feature = "v2020_1", feature = "dox"))]
use CommitSizesEntry;
use DiffFlags;
use DiffItem;
use ObjectType;
@@ -105,10 +107,15 @@ pub fn commit_get_content_checksum(commit_variant: &glib::Variant) -> Option<GSt
}
}
//#[cfg(any(feature = "v2020_1", feature = "dox"))]
//pub fn commit_get_object_sizes(commit_variant: &glib::Variant, out_sizes_entries: /*Ignored*/Vec<CommitSizesEntry>) -> Result<(), glib::Error> {
// unsafe { TODO: call ostree_sys:ostree_commit_get_object_sizes() }
//}
#[cfg(any(feature = "v2020_1", feature = "dox"))]
pub fn commit_get_object_sizes(commit_variant: &glib::Variant) -> Result<Vec<CommitSizesEntry>, glib::Error> {
unsafe {
let mut out_sizes_entries = ptr::null_mut();
let mut error = ptr::null_mut();
let _ = ostree_sys::ostree_commit_get_object_sizes(commit_variant.to_glib_none().0, &mut out_sizes_entries, &mut error);
if error.is_null() { Ok(FromGlibPtrContainer::from_glib_container(out_sizes_entries)) } else { Err(from_glib_full(error)) }
}
}
pub fn commit_get_parent(commit_variant: &glib::Variant) -> Option<GString> {
unsafe {
+5
View File
@@ -80,6 +80,11 @@ mod collection_ref;
#[cfg(any(feature = "v2018_6", feature = "dox"))]
pub use self::collection_ref::CollectionRef;
#[cfg(any(feature = "v2020_1", feature = "dox"))]
mod commit_sizes_entry;
#[cfg(any(feature = "v2020_1", feature = "dox"))]
pub use self::commit_sizes_entry::CommitSizesEntry;
mod diff_item;
pub use self::diff_item::DiffItem;
+1 -1
View File
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 2d1ffab1)
from gir-files (https://github.com/gtk-rs/gir-files @ eec42a9)
from gir-files (https://github.com/gtk-rs/gir-files @ ff904f0)