pub struct InMemoryResult {
pub new_content: String,
pub report: ApplyResult,
}Expand description
The result of an in-memory patch operation.
This struct is returned by functions like apply_patch_to_content() and
apply_patch_to_lines(). It contains the newly generated content as a string,
along with a detailed report of the outcome for each hunk.
§Example
let original_content = "line one\n";
let diff = r#"
```diff
--- a/test.txt
+++ b/test.txt
@@ -1 +1 @@
-line one
+line 1
```
"#;
let patch = parse_single_patch(diff)?;
let options = ApplyOptions::new();
let result = apply_patch_to_content(&patch, Some(original_content), &options);
assert!(result.report.all_applied_cleanly());
assert_eq!(result.new_content, "line 1\n");Fields§
§new_content: StringThe new content after applying the patch.
report: ApplyResultDetailed results for each hunk within the patch operation.
Trait Implementations§
Source§impl Clone for InMemoryResult
impl Clone for InMemoryResult
Source§fn clone(&self) -> InMemoryResult
fn clone(&self) -> InMemoryResult
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 moreSource§impl Debug for InMemoryResult
impl Debug for InMemoryResult
Source§impl PartialEq for InMemoryResult
impl PartialEq for InMemoryResult
impl StructuralPartialEq for InMemoryResult
Auto Trait Implementations§
impl Freeze for InMemoryResult
impl RefUnwindSafe for InMemoryResult
impl Send for InMemoryResult
impl Sync for InMemoryResult
impl Unpin for InMemoryResult
impl UnsafeUnpin for InMemoryResult
impl UnwindSafe for InMemoryResult
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> 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