pub struct CodeChangeHunk { /* private fields */ }Expand description
One grouped hunk of a code-change presentation.
Implementations§
Source§impl CodeChangeHunk
impl CodeChangeHunk
Sourcepub fn new(
old_start: u32,
old_lines: u32,
new_start: u32,
new_lines: u32,
lines: Vec<CodeChangeLine>,
) -> Result<Self, CodeChangeValidationError>
pub fn new( old_start: u32, old_lines: u32, new_start: u32, new_lines: u32, lines: Vec<CodeChangeLine>, ) -> Result<Self, CodeChangeValidationError>
Creates a validated diff hunk.
§Errors
Returns an error when line counts or contained lines violate the durable presentation contract.
Sourcepub const fn old_start(&self) -> u32
pub const fn old_start(&self) -> u32
Returns the old-file hunk start, with zero permitted for an empty file.
Sourcepub const fn old_lines(&self) -> u32
pub const fn old_lines(&self) -> u32
Returns the number of old-file lines covered by this hunk.
Sourcepub const fn new_start(&self) -> u32
pub const fn new_start(&self) -> u32
Returns the new-file hunk start, with zero permitted for an empty file.
Sourcepub const fn new_lines(&self) -> u32
pub const fn new_lines(&self) -> u32
Returns the number of new-file lines covered by this hunk.
Sourcepub fn lines(&self) -> &[CodeChangeLine]
pub fn lines(&self) -> &[CodeChangeLine]
Returns ordered, line-numbered hunk lines.
Trait Implementations§
Source§impl Clone for CodeChangeHunk
impl Clone for CodeChangeHunk
Source§fn clone(&self) -> CodeChangeHunk
fn clone(&self) -> CodeChangeHunk
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CodeChangeHunk
impl Debug for CodeChangeHunk
Source§impl<'de> Deserialize<'de> for CodeChangeHunk
impl<'de> Deserialize<'de> for CodeChangeHunk
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 CodeChangeHunk
Source§impl Ord for CodeChangeHunk
impl Ord for CodeChangeHunk
Source§fn cmp(&self, other: &CodeChangeHunk) -> Ordering
fn cmp(&self, other: &CodeChangeHunk) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for CodeChangeHunk
impl PartialEq for CodeChangeHunk
Source§impl PartialOrd for CodeChangeHunk
impl PartialOrd for CodeChangeHunk
Source§impl Serialize for CodeChangeHunk
impl Serialize for CodeChangeHunk
impl StructuralPartialEq for CodeChangeHunk
Auto Trait Implementations§
impl Freeze for CodeChangeHunk
impl RefUnwindSafe for CodeChangeHunk
impl Send for CodeChangeHunk
impl Sync for CodeChangeHunk
impl Unpin for CodeChangeHunk
impl UnsafeUnpin for CodeChangeHunk
impl UnwindSafe for CodeChangeHunk
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