#[non_exhaustive]pub struct Patch {
pub ops: Vec<PatchOp>,
}Expand description
A parsed patch: its file operations in order.
§Example
use adk_devtools::patch::{PatchOp, parse_patch};
let patch = parse_patch("*** Begin Patch\n*** Delete File: old.txt\n*** End Patch\n")?;
assert_eq!(patch.ops, vec![PatchOp::Delete { path: "old.txt".into() }]);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.ops: Vec<PatchOp>The file operations, in the order the patch lists them.
Implementations§
Source§impl Patch
impl Patch
Sourcepub fn paths(&self) -> Vec<&str>
pub fn paths(&self) -> Vec<&str>
Every path the patch names — the source and destination of a move included — in order, as the headers write them. The harness policy reads these (spec 3.1 §7.26).
§Example
let patch = adk_devtools::patch::parse_patch(
"*** Begin Patch\n*** Update File: a.rs\n*** Move to: b.rs\n@@\n-x\n+y\n*** End Patch",
)?;
assert_eq!(patch.paths(), vec!["a.rs", "b.rs"]);Trait Implementations§
impl Eq for Patch
impl StructuralPartialEq for Patch
Auto Trait Implementations§
impl Forget for Patch
impl Freeze for Patch
impl Move for Patch
impl RefUnwindSafe for Patch
impl Send for Patchwhere
RawVecInner: Send,
impl Sync for Patchwhere
RawVecInner: Sync,
impl Unpin for Patch
impl UnsafeUnpin for Patch
impl UnwindSafe for Patchwhere
RawVecInner: UnwindSafe,
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