pub struct ChangeSet { /* private fields */ }Expand description
Non-overlapping edits grouped by file, kept sorted by span, plus file moves.
Edits to a moved file are keyed by its current path; the move is applied after the edits, so a planner never has to think about ordering.
Implementations§
Source§impl ChangeSet
impl ChangeSet
pub fn new() -> Self
Sourcepub fn move_file(
&mut self,
from: impl Into<PathBuf>,
to: impl Into<PathBuf>,
) -> Result<(), EditConflict>
pub fn move_file( &mut self, from: impl Into<PathBuf>, to: impl Into<PathBuf>, ) -> Result<(), EditConflict>
Record that from ends up at to. Registers from as a touched file.
Sourcepub fn destination(&self, path: &Path) -> Option<&Path>
pub fn destination(&self, path: &Path) -> Option<&Path>
Where path ends up, if it is moved.
pub fn moves(&self) -> impl Iterator<Item = (&Path, &Path)>
Sourcepub fn insert(
&mut self,
path: impl Into<PathBuf>,
edit: Edit,
) -> Result<(), EditConflict>
pub fn insert( &mut self, path: impl Into<PathBuf>, edit: Edit, ) -> Result<(), EditConflict>
Add an edit, refusing one that overlaps an edit already recorded for the file.
pub fn merge(self, other: ChangeSet) -> Result<Self, EditConflict>
pub fn is_empty(&self) -> bool
pub fn paths(&self) -> impl Iterator<Item = &Path>
pub fn edits_for(&self, path: &Path) -> &[Edit]
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ChangeSet
impl<'de> Deserialize<'de> for ChangeSet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ChangeSet
impl StructuralPartialEq for ChangeSet
Auto Trait Implementations§
impl Freeze for ChangeSet
impl RefUnwindSafe for ChangeSet
impl Send for ChangeSet
impl Sync for ChangeSet
impl Unpin for ChangeSet
impl UnsafeUnpin for ChangeSet
impl UnwindSafe for ChangeSet
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