pub struct Hunk {
pub header: String,
pub lines: Vec<String>,
pub added: usize,
pub removed: usize,
}Expand description
One hunk of one file’s diff.
Fields§
§header: StringThe @@ … @@ header, including the trailing function context git adds.
lines: Vec<String>The hunk’s lines, each still carrying its leading , +, or -.
added: usizeLines added by this hunk.
removed: usizeLines removed by this hunk.
Implementations§
Source§impl Hunk
impl Hunk
Sourcepub fn with_context(&self, context: usize) -> Self
pub fn with_context(&self, context: usize) -> Self
The hunk with at most context unchanged lines on each side of every
run of changes.
Trimming is symmetric and interior: context between two nearby changes is kept when it is short enough to serve both, because dropping it would imply the changes are adjacent when they are not.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Hunk
impl<'de> Deserialize<'de> for Hunk
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Hunk
impl StructuralPartialEq for Hunk
Auto Trait Implementations§
impl Freeze for Hunk
impl RefUnwindSafe for Hunk
impl Send for Hunk
impl Sync for Hunk
impl Unpin for Hunk
impl UnsafeUnpin for Hunk
impl UnwindSafe for Hunk
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
Source§impl<T> Canonical for T
impl<T> Canonical for T
Source§fn canonical_bytes(&self) -> Result<Vec<u8>, CanonicalError>
fn canonical_bytes(&self) -> Result<Vec<u8>, CanonicalError>
The canonical CBOR encoding of this value.