pub struct PatchDisplay {
pub field_name: String,
pub original_value: Option<Value>,
pub overridden_value: Value,
}Expand description
Represents a patch with both original and overridden values for display.
Fields§
§field_name: StringField name being patched.
original_value: Option<Value>Original value from the source file (if available).
overridden_value: ValueOverridden value from the patch.
Implementations§
Source§impl PatchDisplay
impl PatchDisplay
Sourcepub fn format(&self) -> String
pub fn format(&self) -> String
Format the patch for display as a diff.
Always uses multi-line diff format with color coding:
- Red
-line for original value (omitted if no original) - Green
+line for overridden value
field:
- "original value" (red)
+ "overridden value" (green)If there’s no original value, only the green + line is shown:
field:
+ "new value" (green)§Examples
let display = PatchDisplay {
field_name: "model".to_string(),
original_value: Some(toml::Value::String("opus".to_string())),
overridden_value: toml::Value::String("haiku".to_string()),
};
let formatted = display.format();
assert!(formatted.contains("model:"));Trait Implementations§
Source§impl Clone for PatchDisplay
impl Clone for PatchDisplay
Source§fn clone(&self) -> PatchDisplay
fn clone(&self) -> PatchDisplay
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PatchDisplay
impl RefUnwindSafe for PatchDisplay
impl Send for PatchDisplay
impl Sync for PatchDisplay
impl Unpin for PatchDisplay
impl UnwindSafe for PatchDisplay
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more