pub enum FilesystemAction {
SetMode {
file: PathBuf,
mode: u32,
},
Delete {
file: PathBuf,
},
Rename {
file: PathBuf,
to: PathBuf,
},
RemoveDirIfEmpty {
file: PathBuf,
},
Write {
file: PathBuf,
content: Vec<u8>,
},
ReplaceText {
file: PathBuf,
range: TextRange,
replacement: String,
},
Substitute {
file: PathBuf,
from: String,
to: String,
},
NormalizeLineEndings {
file: PathBuf,
},
}Expand description
Filesystem-level edits.
Variants§
SetMode
Set the file mode (e.g. mark a script executable).
Delete
Delete a file.
Rename
Move a file from one path to another, atomically when possible. Creates the destination’s parent directory if needed.
Fields
RemoveDirIfEmpty
Remove a directory if it is empty. A no-op if the directory has
any remaining entries — useful as a follow-up to a Delete that
might have been the last file in its parent directory.
Fields
Write
Overwrite (or create) a file with the given content.
ReplaceText
Replace a byte range in a file.
Fields
Substitute
Replace every occurrence of a literal string with another. Operates on the file’s textual content with no awareness of file structure.
Fields
NormalizeLineEndings
Normalise the file’s line endings to LF (i.e. convert any CRLF
sequences to LF). Carries no payload other than the path: each
applier reads the current file, performs the conversion, and
writes back. Modelling this as its own variant (rather than as a
Write carrying the converted bytes) keeps the diagnostic stream
declarative — anyone reading it sees the intent and not a byte
blob — and lets an LSP host emit a structural TextEdit derived
from the open buffer rather than from a possibly-stale snapshot.
Trait Implementations§
Source§impl Clone for FilesystemAction
impl Clone for FilesystemAction
Source§fn clone(&self) -> FilesystemAction
fn clone(&self) -> FilesystemAction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FilesystemAction
impl Debug for FilesystemAction
Source§impl<'de> Deserialize<'de> for FilesystemAction
impl<'de> Deserialize<'de> for FilesystemAction
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>,
impl Eq for FilesystemAction
Source§impl PartialEq for FilesystemAction
impl PartialEq for FilesystemAction
Source§fn eq(&self, other: &FilesystemAction) -> bool
fn eq(&self, other: &FilesystemAction) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for FilesystemAction
impl Serialize for FilesystemAction
impl StructuralPartialEq for FilesystemAction
Auto Trait Implementations§
impl Freeze for FilesystemAction
impl RefUnwindSafe for FilesystemAction
impl Send for FilesystemAction
impl Sync for FilesystemAction
impl Unpin for FilesystemAction
impl UnsafeUnpin for FilesystemAction
impl UnwindSafe for FilesystemAction
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.