Skip to main content

FsRequest

Enum FsRequest 

Source
pub enum FsRequest {
    ReadDir {
        id: NodeId,
        path: PathBuf,
    },
    ReadFile {
        buffer: BufferId,
        path: PathBuf,
    },
    ReadPreview {
        request: PreviewRequestId,
        path: PathBuf,
        line: usize,
        context: usize,
    },
    ResolvePath {
        request: LocationRequestId,
        path: PathBuf,
    },
    WriteFile {
        buffer: BufferId,
        path: PathBuf,
        contents: Vec<u8>,
        version: u64,
    },
    Watch(PathBuf),
    CreateFile(PathBuf),
    CreateDir(PathBuf),
    Rename {
        from: PathBuf,
        to: PathBuf,
    },
    Remove {
        path: PathBuf,
        recursive: bool,
    },
    Shutdown,
}
Expand description

Work sent to the filesystem worker thread.

Intentionally not #[non_exhaustive]: this is internal vocabulary between our own crates, and we want the compiler to flag every unhandled variant rather than letting a wildcard arm swallow it.

Variants§

§

ReadDir

List one directory level for the tree node that asked for it.

Fields

§path: PathBuf
§

ReadFile

Read a whole file for a buffer that is being opened.

Opening a file is blocking I/O like any other, so it goes through the worker rather than the render loop — a cold file on a network mount must not freeze the UI any more than a cold directory does (ADR-0005 §1).

Fields

§buffer: BufferId
§path: PathBuf
§

ReadPreview

Read a small line window for a search-result preview without opening a buffer.

Fields

§path: PathBuf
§line: usize
§context: usize
§

ResolvePath

Canonicalize a diagnostic path before the model decides whether it is safe to open inside the current workspace.

Fields

§path: PathBuf
§

WriteFile

Write a buffer back to disk.

version is the buffer revision these bytes were taken from; it comes back on FsEvent::FileSaved so the buffer only clears its dirty flag if nothing was typed while the write was in flight. Carried as a raw u64 because core must not depend on editor.

Fields

§buffer: BufferId
§path: PathBuf
§contents: Vec<u8>
§version: u64
§

Watch(PathBuf)

Begin watching a root for changes.

§

CreateFile(PathBuf)

§

CreateDir(PathBuf)

§

Rename

Fields

§from: PathBuf
§

Remove

Delete a file, or a directory and everything under it. The caller must have confirmed with the user first — the worker does not second-guess it.

Fields

§path: PathBuf
§recursive: bool
§

Shutdown

Stop the worker. Sent on shutdown so the thread exits its loop cleanly.

Trait Implementations§

Source§

impl Clone for FsRequest

Source§

fn clone(&self) -> FsRequest

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FsRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for FsRequest

Source§

impl PartialEq for FsRequest

Source§

fn eq(&self, other: &FsRequest) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FsRequest

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.