pub struct PackObject<'a> {
pub id: ObjectId,
pub kind: ObjectKind,
pub data: &'a [u8],
}Expand description
One format-bearing object to export, borrowing its exact uncompressed payload.
The writer verifies id against kind and data. Payload syntax and referenced object
existence are not checked; callers choose the object set and any graph validation. The kind
enum admits only blobs, trees, commits, and tags, never delta or reserved pack types.
Use this borrowed input when exporting a caller-selected set of objects. The ID is an expectation checked against kind and bytes; it does not ask the writer to fetch data or validate graph completeness.
use girt::{
ObjectFormat, ObjectId, ObjectKind, PackObject, PackWriteError, PackWriteLimits, write_pack,
};
let input = PackObject {
id: ObjectId::for_blob(ObjectFormat::Sha1, b"original"),
kind: ObjectKind::Blob,
data: b"changed",
};
let (mut pack, mut index) = (Vec::new(), Vec::new());
assert!(matches!(
write_pack(
ObjectFormat::Sha1,
&[input],
&mut pack,
&mut index,
PackWriteLimits::default()
),
Err(PackWriteError::Identity { .. })
));
assert!(pack.is_empty() && index.is_empty());Fields§
§id: ObjectIdExpected identity, including the canonical Git kind/length header in the hash.
kind: ObjectKindLogical object kind.
data: &'a [u8]Exact payload without loose-object framing.
Trait Implementations§
Source§impl<'a> Clone for PackObject<'a>
impl<'a> Clone for PackObject<'a>
impl<'a> Copy for PackObject<'a>
Auto Trait Implementations§
impl<'a> Freeze for PackObject<'a>
impl<'a> RefUnwindSafe for PackObject<'a>
impl<'a> Send for PackObject<'a>
impl<'a> Sync for PackObject<'a>
impl<'a> Unpin for PackObject<'a>
impl<'a> UnsafeUnpin for PackObject<'a>
impl<'a> UnwindSafe for PackObject<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more