pub trait PatchSource {
// Required method
fn read(&mut self, patch: u32, offset: u64, dst: &mut [u8]) -> Result<()>;
}Expand description
Source of patch-file bytes for an IndexApplier.
Implementations must fill dst completely with dst.len() source bytes
starting at offset in the patch identified by patch. A short read —
fewer than dst.len() bytes available — must surface as
ZiPatchError::PatchSourceTooShort, not as a partial fill. An
out-of-range patch must surface as
ZiPatchError::PatchIndexOutOfRange.
Required Methods§
Sourcefn read(&mut self, patch: u32, offset: u64, dst: &mut [u8]) -> Result<()>
fn read(&mut self, patch: u32, offset: u64, dst: &mut [u8]) -> Result<()>
Fill dst with dst.len() source bytes starting at offset in the
patch indexed by patch.
§Errors
ZiPatchError::PatchIndexOutOfRange—patchis>= count.ZiPatchError::PatchSourceTooShort— the source has fewer thandst.len()bytes atoffsetin patchpatch.ZiPatchError::Io— underlying I/O failure (only meaningful for sources backed by real I/O, e.g.FilePatchSource).