pub struct PatchFormatter { /* private fields */ }
Expand description
Struct used to adjust the formatting of a Patch
Implementations§
Source§impl PatchFormatter
impl PatchFormatter
Sourcepub fn with_color(self) -> Self
pub fn with_color(self) -> Self
Enable formatting a patch with color
Sourcepub fn missing_newline_message(self, enable: bool) -> Self
pub fn missing_newline_message(self, enable: bool) -> Self
Sets whether to format a patch with a “No newline at end of file” message.
Default is true
.
Note: If this is disabled by setting to false
, formatted patches will no longer contain
sufficient information to determine if a file ended with a newline character (\n
) or not
and the patch will be formatted as if both the original and modified files ended with a
newline character (\n
).
Sourcepub fn suppress_blank_empty(self, enable: bool) -> Self
pub fn suppress_blank_empty(self, enable: bool) -> Self
Sets whether to suppress printing of a space before empty lines.
Defaults to true
.
For more information you can refer to the Omitting trailing blanks manual page of GNU
diff or the diff.suppressBlankEmpty config for git-diff
.
Sourcepub fn fmt_patch<'a>(&'a self, patch: &'a Patch<'a, str>) -> impl Display + 'a
pub fn fmt_patch<'a>(&'a self, patch: &'a Patch<'a, str>) -> impl Display + 'a
Returns a Display
impl which can be used to print a Patch
pub fn write_patch_into<T: ToOwned + AsRef<[u8]> + ?Sized, W: Write>( &self, patch: &Patch<'_, T>, w: W, ) -> Result<()>
Trait Implementations§
Source§impl Debug for PatchFormatter
impl Debug for PatchFormatter
Auto Trait Implementations§
impl Freeze for PatchFormatter
impl RefUnwindSafe for PatchFormatter
impl Send for PatchFormatter
impl Sync for PatchFormatter
impl Unpin for PatchFormatter
impl UnwindSafe for PatchFormatter
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