pub struct Workspace {
pub root: PathBuf,
/* private fields */
}Expand description
Repo-aware resolver for @-mentions and file pickers.
cwd is captured at construction; if the host’s current directory changes
during a session, build a fresh Workspace. Composer discovery callers run
its bounded walkers on a background worker; Workspace::resolve_exact
deliberately performs no fuzzy tree traversal.
Fields§
§root: PathBufImplementations§
Source§impl Workspace
impl Workspace
Sourcepub fn new(root: PathBuf) -> Self
pub fn new(root: PathBuf) -> Self
Construct a workspace anchored at root, capturing the process CWD as
the secondary resolution pass. Convenience entry point intended for
callers that don’t already have a CWD on hand; the App routes through
Workspace::with_cwd with its own captured launch directory.
Sourcepub fn with_cwd(root: PathBuf, cwd: Option<PathBuf>) -> Self
pub fn with_cwd(root: PathBuf, cwd: Option<PathBuf>) -> Self
Construct with an explicit cwd. Used by tests that need deterministic resolution against a known directory without depending on (and mutating) the process’s real working directory.
Sourcepub fn with_cwd_and_depth(
root: PathBuf,
cwd: Option<PathBuf>,
walk_depth: usize,
) -> Self
pub fn with_cwd_and_depth( root: PathBuf, cwd: Option<PathBuf>, walk_depth: usize, ) -> Self
Construct with an explicit completion walk depth. A depth of 0
disables the depth limit for users with deeply nested workspaces.
Sourcepub fn with_cwd_depth_and_follow_links(
root: PathBuf,
cwd: Option<PathBuf>,
walk_depth: usize,
follow_links: bool,
) -> Self
pub fn with_cwd_depth_and_follow_links( root: PathBuf, cwd: Option<PathBuf>, walk_depth: usize, follow_links: bool, ) -> Self
Construct with an explicit completion walk depth and symlink-following
preference. See Workspace::follow_links.
Sourcepub fn resolve_exact(&self, raw_path: &str) -> Result<PathBuf, PathBuf>
pub fn resolve_exact(&self, raw_path: &str) -> Result<PathBuf, PathBuf>
Resolve only the path the user actually typed: workspace, then cwd.
Composer send-time resolution uses this path because fuzzy fallback builds a full basename index. Fuzzy tree discovery is instead confined to the bounded background completion worker (#4365).
Sourcepub fn completion_discovery_candidates(
&self,
limit: usize,
cancelled: &dyn Fn() -> bool,
) -> Vec<String>
pub fn completion_discovery_candidates( &self, limit: usize, cancelled: &dyn Fn() -> bool, ) -> Vec<String>
Candidate collection used by the composer background worker. The walk
is hard-capped and checks cancelled between filesystem iterator
steps. A single slow iterator step may still return late, but it runs on
the discovery worker and can never park terminal input (#4365).
Sourcepub fn browser_completion_discovery_candidates(
&self,
partial: &str,
limit: usize,
cancelled: &dyn Fn() -> bool,
) -> Vec<String>
pub fn browser_completion_discovery_candidates( &self, partial: &str, limit: usize, cancelled: &dyn Fn() -> bool, ) -> Vec<String>
Background-worker directory-browser collection. It stops at limit
before sorting, so a directory with millions of direct children cannot
grow the cache without bound.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Workspace
impl Freeze for Workspace
impl Move for Workspace
impl RefUnwindSafe for Workspace
impl Send for Workspace
impl Sync for Workspace
impl Unpin for Workspace
impl UnsafeUnpin for Workspace
impl UnwindSafe for Workspace
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.