pub struct ConsumeBinaryHunk<'a, D> {
pub newline: &'a str,
pub delegate: D,
/* private fields */
}Available on crate feature
blob only.Expand description
An adapter with ConsumeHunk implementation to call a delegate which receives each stringified hunk.
Fields§
§newline: &'a strThe newline to use to separate lines if these don’t yet contain a newline. It should also be used to separate the stringified header from the hunk itself.
delegate: DThe delegate to receive stringified hunks.
Implementations§
Source§impl<'a, D> ConsumeBinaryHunk<'a, D>where
D: ConsumeBinaryHunkDelegate,
impl<'a, D> ConsumeBinaryHunk<'a, D>where
D: ConsumeBinaryHunkDelegate,
Sourcepub fn new(delegate: D, newline: &'a str) -> ConsumeBinaryHunk<'a, D>
pub fn new(delegate: D, newline: &'a str) -> ConsumeBinaryHunk<'a, D>
Create a new instance that writes stringified hunks to delegate, which uses newline to separate header and hunk,
as well as hunk lines that don’t naturally end in a newline.
Trait Implementations§
Source§impl<D> ConsumeHunk for ConsumeBinaryHunk<'_, D>where
D: ConsumeBinaryHunkDelegate,
An implementation that fails if the input isn’t UTF-8.
impl<D> ConsumeHunk for ConsumeBinaryHunk<'_, D>where
D: ConsumeBinaryHunkDelegate,
An implementation that fails if the input isn’t UTF-8.
Source§fn consume_hunk(
&mut self,
header: HunkHeader,
lines: &[(DiffLineKind, &[u8])],
) -> Result<()>
fn consume_hunk( &mut self, header: HunkHeader, lines: &[(DiffLineKind, &[u8])], ) -> Result<()>
Consume a single hunk which is represented by its
lines, each of which with a DiffLineKind value
to know if it’s added, removed or context.
The header specifies hunk offsets, which positions the lines in the old and new file respectively. Read moreAuto Trait Implementations§
impl<'a, D> Freeze for ConsumeBinaryHunk<'a, D>where
D: Freeze,
impl<'a, D> RefUnwindSafe for ConsumeBinaryHunk<'a, D>where
D: RefUnwindSafe,
impl<'a, D> Send for ConsumeBinaryHunk<'a, D>where
D: Send,
impl<'a, D> Sync for ConsumeBinaryHunk<'a, D>where
D: Sync,
impl<'a, D> Unpin for ConsumeBinaryHunk<'a, D>where
D: Unpin,
impl<'a, D> UnwindSafe for ConsumeBinaryHunk<'a, D>where
D: UnwindSafe,
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