pub struct ExtensionRegistry { /* private fields */ }Expand description
Merged, extends-resolved extension registry.
Implementations§
Source§impl ExtensionRegistry
impl ExtensionRegistry
Sourcepub fn load(
defaults: &Path,
project: Option<&Path>,
) -> Result<Self, ExtensionError>
pub fn load( defaults: &Path, project: Option<&Path>, ) -> Result<Self, ExtensionError>
Load shipped defaults and an optional project registry, then merge.
Later files override earlier entries by id (in-place). extends is
resolved after merge. User config (~/.config/wyvern/extensions.json)
is not loaded in Phase F.
§Errors
Returns ExtensionError::InvalidRegistry for unreadable or invalid JSON.
Sourcepub fn load_default() -> Result<Self, ExtensionError>
pub fn load_default() -> Result<Self, ExtensionError>
Load shipped defaults plus .wyvern/extensions.json from the cwd.
§Errors
Returns ExtensionError::InvalidRegistry when a registry file is invalid.
Sourcepub fn from_json_str(json: &str) -> Result<Self, ExtensionError>
pub fn from_json_str(json: &str) -> Result<Self, ExtensionError>
Parse a registry from an in-memory JSON string (tests and shipped fallback).
§Errors
Returns ExtensionError::InvalidRegistry when json is not a v1 registry.
Sourcepub fn match_argv<'a>(
&'a self,
argv: &'a [String],
) -> Option<ExtensionMatch<'a>>
pub fn match_argv<'a>( &'a self, argv: &'a [String], ) -> Option<ExtensionMatch<'a>>
Walk merged extensions in order; first match wins.
After extends resolution, an extension whose preexec.requires binaries
are absent on PATH does not match (fallthrough).
Sourcepub fn match_argv_with<'a>(
&'a self,
argv: &'a [String],
probe: &dyn RequiresProbe,
) -> Option<ExtensionMatch<'a>>
pub fn match_argv_with<'a>( &'a self, argv: &'a [String], probe: &dyn RequiresProbe, ) -> Option<ExtensionMatch<'a>>
Self::match_argv with an injectable RequiresProbe.
Sourcepub fn match_with_diagnostics<'a>(
&'a self,
argv: &'a [String],
) -> MatchOutcome<'a>
pub fn match_with_diagnostics<'a>( &'a self, argv: &'a [String], ) -> MatchOutcome<'a>
Match argv and record extensions skipped for missing requires.
Sourcepub fn match_with_diagnostics_with<'a>(
&'a self,
argv: &'a [String],
probe: &dyn RequiresProbe,
) -> MatchOutcome<'a>
pub fn match_with_diagnostics_with<'a>( &'a self, argv: &'a [String], probe: &dyn RequiresProbe, ) -> MatchOutcome<'a>
Self::match_with_diagnostics with an injectable RequiresProbe.
Sourcepub fn extensions(&self) -> &[ExtensionDef]
pub fn extensions(&self) -> &[ExtensionDef]
Merged extensions in match order.
Trait Implementations§
Source§impl Clone for ExtensionRegistry
impl Clone for ExtensionRegistry
Source§fn clone(&self) -> ExtensionRegistry
fn clone(&self) -> ExtensionRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ExtensionRegistry
impl RefUnwindSafe for ExtensionRegistry
impl Send for ExtensionRegistry
impl Sync for ExtensionRegistry
impl Unpin for ExtensionRegistry
impl UnsafeUnpin for ExtensionRegistry
impl UnwindSafe for ExtensionRegistry
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.