pub struct DetectorRegistry { /* private fields */ }Expand description
Registry of registered Detectors. Use DetectorRegistry::with_builtins
for the default set, or DetectorRegistry::empty to build from scratch.
Implementations§
Source§impl DetectorRegistry
impl DetectorRegistry
Sourcepub fn with_builtins() -> Self
pub fn with_builtins() -> Self
New registry preloaded with every detector this crate ships.
Sourcepub fn remove(&mut self, name: &str) -> usize
pub fn remove(&mut self, name: &str) -> usize
Remove every detector whose name() equals name. Returns the
number of detectors removed.
Sourcepub fn names(&self) -> Vec<&str>
pub fn names(&self) -> Vec<&str>
List the names of registered detectors, in registration order.
Sourcepub fn project_kinds(&self) -> Vec<KindId>
pub fn project_kinds(&self) -> Vec<KindId>
Collect the project KindIds advertised by registered detectors.
Returns deduplicated set in registration order. Detectors that
don’t advertise a kind (workspace-only or dynamic) are skipped.
Sourcepub fn workspace_kinds(&self) -> Vec<WorkspaceKindId>
pub fn workspace_kinds(&self) -> Vec<WorkspaceKindId>
Collect the WorkspaceKindIds advertised by registered detectors.
Sourcepub fn detect(&self, dir: &Path) -> Vec<DetectorHit>
pub fn detect(&self, dir: &Path) -> Vec<DetectorHit>
Run every detector against dir and collect the hits.
Per-facet disambiguation rules:
- Project facet: at most ONE project hit per directory wins —
the highest-priority detector across ALL project kinds. Two
detectors firing for the same dir (e.g. NodeDetector +
BunDetector when both
package.jsonandbun.lockare present) collapse to the higher-priority one (Bun=80 > Node=50). - Workspace facet: multiple workspace kinds CAN coexist at
the same root (Cargo + Npm in a Tauri-style repo). Within the
same
WorkspaceKindId, the higher-priority detector wins.
A DetectorHit::Both competes on both facets simultaneously.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DetectorRegistry
impl !RefUnwindSafe for DetectorRegistry
impl Send for DetectorRegistry
impl Sync for DetectorRegistry
impl Unpin for DetectorRegistry
impl UnsafeUnpin for DetectorRegistry
impl !UnwindSafe for DetectorRegistry
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