pub struct Encoder<'a> { /* private fields */ }Expand description
A resumable pack encoder. Retain the repository and selected order unchanged
until EOF. read performs at most one object-body read, bounded by its output
slice. The cursor owns hash/framing state, never object or pack-sized storage.
Implementations§
Source§impl<'a> Encoder<'a>
impl<'a> Encoder<'a>
Sourcepub fn new(
repository: &impl Repository,
order: Option<&'a [usize]>,
) -> Result<Self>
pub fn new( repository: &impl Repository, order: Option<&'a [usize]>, ) -> Result<Self>
Encode all objects (None) or the supplied unique indices, in order.
Invalid selections fail before the first output byte.
Sourcepub fn read(
&mut self,
repository: &impl Repository,
output: &mut [u8],
) -> Result<usize>
pub fn read( &mut self, repository: &impl Repository, output: &mut [u8], ) -> Result<usize>
Return bytes to stage for transport. Preserve unsent bytes at the host; calling again advances the cursor. Zero means complete, never pending. Backend read failures leave the failed read resumable. After any failure, discard bytes in that call’s output slice. Earlier successful pulls stand.
Auto Trait Implementations§
impl<'a> Freeze for Encoder<'a>
impl<'a> RefUnwindSafe for Encoder<'a>
impl<'a> Send for Encoder<'a>
impl<'a> Sync for Encoder<'a>
impl<'a> Unpin for Encoder<'a>
impl<'a> UnsafeUnpin for Encoder<'a>
impl<'a> UnwindSafe for Encoder<'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