pub enum Op<'a> {
Copy {
offset: u32,
len: u32,
},
Add(&'a [u8]),
}Expand description
A single patch opcode.
Variants§
Implementations§
Source§impl<'a> Op<'a>
impl<'a> Op<'a>
Sourcepub fn serialize_to(&self, out: &mut Vec<u8>) -> Result<(), PatchError>
pub fn serialize_to(&self, out: &mut Vec<u8>) -> Result<(), PatchError>
Serialize this op into out.
§Errors
Returns PatchError::InputTooLarge if an Add payload exceeds
u32::MAX bytes.
Sourcepub fn deserialize(input: &'a [u8]) -> Result<(Self, &'a [u8]), PatchError>
pub fn deserialize(input: &'a [u8]) -> Result<(Self, &'a [u8]), PatchError>
Parse the next opcode from input, returning the op and the remaining
bytes.
§Errors
See PatchError variants.
Sourcepub fn iter(patch: &'a [u8]) -> OpIter<'a> ⓘ
pub fn iter(patch: &'a [u8]) -> OpIter<'a> ⓘ
Iterate the opcodes in patch lazily, without allocating a Vec.
Both container formats are accepted; the sectioned v2 layout is
reassembled into the same opcode sequence a v1 patch would have
carried. The base fingerprint in a v2 header is not checked here —
crate::apply_patch does that.
Trait Implementations§
impl<'a> Copy for Op<'a>
impl<'a> Eq for Op<'a>
impl<'a> StructuralPartialEq for Op<'a>
Auto Trait Implementations§
impl<'a> Freeze for Op<'a>
impl<'a> RefUnwindSafe for Op<'a>
impl<'a> Send for Op<'a>
impl<'a> Sync for Op<'a>
impl<'a> Unpin for Op<'a>
impl<'a> UnsafeUnpin for Op<'a>
impl<'a> UnwindSafe for Op<'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