pub struct CodeChange { /* private fields */ }Expand description
Bounded, structured presentation of one changed file.
Implementations§
Source§impl CodeChange
impl CodeChange
Sourcepub fn new(
path: impl Into<String>,
kind: CodeChangeKind,
hunks: Vec<CodeChangeHunk>,
truncated: bool,
truncation: Option<CodeChangeTruncation>,
unified_patch: Option<String>,
first_changed_line: Option<u32>,
) -> Result<Self, CodeChangeValidationError>
pub fn new( path: impl Into<String>, kind: CodeChangeKind, hunks: Vec<CodeChangeHunk>, truncated: bool, truncation: Option<CodeChangeTruncation>, unified_patch: Option<String>, first_changed_line: Option<u32>, ) -> Result<Self, CodeChangeValidationError>
Creates a validated structured file change.
§Errors
Returns an error when presentation data exceeds its stable storage bounds or its truncation marker is inconsistent.
Sourcepub const fn kind(&self) -> CodeChangeKind
pub const fn kind(&self) -> CodeChangeKind
Returns the file-change kind.
Sourcepub fn hunks(&self) -> &[CodeChangeHunk]
pub fn hunks(&self) -> &[CodeChangeHunk]
Returns ordered structured hunks.
Sourcepub const fn truncated(&self) -> bool
pub const fn truncated(&self) -> bool
Returns whether any presentation bound caused truncation.
Sourcepub const fn truncation(&self) -> Option<CodeChangeTruncation>
pub const fn truncation(&self) -> Option<CodeChangeTruncation>
Returns the deterministic truncation reason when the change was truncated.
Sourcepub const fn first_changed_line(&self) -> Option<u32>
pub const fn first_changed_line(&self) -> Option<u32>
Returns the first changed one-based new-file line when available.
Trait Implementations§
Source§impl Clone for CodeChange
impl Clone for CodeChange
Source§fn clone(&self) -> CodeChange
fn clone(&self) -> CodeChange
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 CodeChange
impl Debug for CodeChange
Source§impl<'de> Deserialize<'de> for CodeChange
impl<'de> Deserialize<'de> for CodeChange
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 CodeChange
Source§impl Ord for CodeChange
impl Ord for CodeChange
Source§fn cmp(&self, other: &CodeChange) -> Ordering
fn cmp(&self, other: &CodeChange) -> 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 CodeChange
impl PartialEq for CodeChange
Source§impl PartialOrd for CodeChange
impl PartialOrd for CodeChange
Source§impl Serialize for CodeChange
impl Serialize for CodeChange
impl StructuralPartialEq for CodeChange
Auto Trait Implementations§
impl Freeze for CodeChange
impl RefUnwindSafe for CodeChange
impl Send for CodeChange
impl Sync for CodeChange
impl Unpin for CodeChange
impl UnsafeUnpin for CodeChange
impl UnwindSafe for CodeChange
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