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: String
Field name being patched.
original_value: Option<Value>
Original value from the source file (if available).
overridden_value: Value
Overridden 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