pub struct WorkspaceSnapshot {
pub root: String,
pub files: Vec<String>,
pub contents: BTreeMap<String, String>,
}Expand description
A minimal read-only snapshot of the workspace used for domain detection and domain-native workspace verification.
Fields§
§root: String§files: Vec<String>Workspace-relative paths discovered by a read-only scan.
contents: BTreeMap<String, String>Optional UTF-8 file contents keyed by workspace-relative path.
Implementations§
Source§impl WorkspaceSnapshot
impl WorkspaceSnapshot
pub fn new(root: impl Into<String>, files: Vec<String>) -> Self
Sourcepub fn with_contents(self, contents: BTreeMap<String, String>) -> Self
pub fn with_contents(self, contents: BTreeMap<String, String>) -> Self
Attach in-memory UTF-8 file contents keyed by workspace-relative path.
Sourcepub fn read_text(&self, rel_path: &str) -> Option<String>
pub fn read_text(&self, rel_path: &str) -> Option<String>
Read a workspace-relative UTF-8 text file from cached snapshot contents,
falling back to root/rel_path when present.
Sourcepub fn has_file_named(&self, name: &str) -> bool
pub fn has_file_named(&self, name: &str) -> bool
Whether any discovered file ends with the given suffix.
Trait Implementations§
Source§impl Clone for WorkspaceSnapshot
impl Clone for WorkspaceSnapshot
Source§impl Debug for WorkspaceSnapshot
impl Debug for WorkspaceSnapshot
Source§impl Default for WorkspaceSnapshot
impl Default for WorkspaceSnapshot
Source§impl<'de> Deserialize<'de> for WorkspaceSnapshot
impl<'de> Deserialize<'de> for WorkspaceSnapshot
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
Source§impl PartialEq for WorkspaceSnapshot
impl PartialEq for WorkspaceSnapshot
Source§impl Serialize for WorkspaceSnapshot
impl Serialize for WorkspaceSnapshot
impl StructuralPartialEq for WorkspaceSnapshot
Auto Trait Implementations§
impl Freeze for WorkspaceSnapshot
impl RefUnwindSafe for WorkspaceSnapshot
impl Send for WorkspaceSnapshot
impl Sync for WorkspaceSnapshot
impl Unpin for WorkspaceSnapshot
impl UnsafeUnpin for WorkspaceSnapshot
impl UnwindSafe for WorkspaceSnapshot
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
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>,
impl<T> Scalar for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.