pub struct CowMut;Expand description
Copy-on-Write mutation patterns for safe AST manipulation.
These patterns ensure the original AST is never modified, making it safe to work with multiple “versions” of the code.
Implementations§
Source§impl CowMut
impl CowMut
Sourcepub fn rename(ast: &RustAST, old: &str, new: &str) -> MutResult<RenameResult>
pub fn rename(ast: &RustAST, old: &str, new: &str) -> MutResult<RenameResult>
Apply a rename with Copy-on-Write semantics.
Returns a new AST, leaving the original unchanged.
Sourcepub fn multi_rename(
ast: &RustAST,
renames: &[(&str, &str)],
) -> Vec<MutResult<RenameResult>>
pub fn multi_rename( ast: &RustAST, renames: &[(&str, &str)], ) -> Vec<MutResult<RenameResult>>
Apply multiple independent renames, each producing a new AST.
Returns one result per rename operation.
Sourcepub fn chain_renames(
ast: &RustAST,
renames: &[(&str, &str)],
) -> MutResult<Vec<RenameResult>>
pub fn chain_renames( ast: &RustAST, renames: &[(&str, &str)], ) -> MutResult<Vec<RenameResult>>
Chain multiple renames on the same AST.
Each rename is applied sequentially to the result of the previous.
Auto Trait Implementations§
impl Freeze for CowMut
impl RefUnwindSafe for CowMut
impl Send for CowMut
impl Sync for CowMut
impl Unpin for CowMut
impl UnsafeUnpin for CowMut
impl UnwindSafe for CowMut
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