pub struct Snapshot {
pub file: PathBuf,
pub id: String,
pub revision: u64,
pub primary: PathBuf,
pub roots: Vec<AttachedRoot>,
pub unavailable: Vec<String>,
}Expand description
An immutable view of one Workspace revision.
Fields§
§file: PathBuf§id: String§revision: u64§primary: PathBufCanonical primary root (read-write).
roots: Vec<AttachedRoot>Canonical additional roots that exist; see Snapshot::unavailable.
Attached roots that no longer resolve to the recorded directory (deleted, or replaced by a symlink). They grant nothing.
Implementations§
Source§impl Snapshot
impl Snapshot
Sourcepub fn granting_roots(&self) -> impl Iterator<Item = (&Path, Access)>
pub fn granting_roots(&self) -> impl Iterator<Item = (&Path, Access)>
Every root that grants access, primary first.
Sourcepub fn additional_root_strings(&self) -> Vec<String>
pub fn additional_root_strings(&self) -> Vec<String>
The additional roots as strings, for the request’s tool context.
Sourcepub fn root_for(&self, canonical: &Path) -> Option<(&Path, Access)>
pub fn root_for(&self, canonical: &Path) -> Option<(&Path, Access)>
The granting root containing the canonical path, if any. The most
specific root wins, so a read-only root nested in a read-write one
stays read-only.
Sourcepub fn admits(&self, canonical: &Path) -> bool
pub fn admits(&self, canonical: &Path) -> bool
True when the canonical path lies in a granting root.
Sourcepub fn admits_write(&self, canonical: &Path) -> bool
pub fn admits_write(&self, canonical: &Path) -> bool
True when the canonical path lies in a read-write root.
Sourcepub fn project_root_for(&self, wanted: &str) -> String
pub fn project_root_for(&self, wanted: &str) -> String
The request’s project root: wanted when a granting root contains
it, else the primary root.
Sourcepub fn status_line(&self) -> String
pub fn status_line(&self) -> String
One line naming the binding, for MCP status output.
Trait Implementations§
impl Eq for Snapshot
impl StructuralPartialEq for Snapshot
Auto Trait Implementations§
impl Forget for Snapshot
impl Freeze for Snapshot
impl Move for Snapshot
impl RefUnwindSafe for Snapshot
impl Send for Snapshot
impl Sync for Snapshot
impl Unpin for Snapshot
impl UnsafeUnpin for Snapshot
impl UnwindSafe for Snapshot
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more