pub struct SkillInjector { /* private fields */ }Implementations§
Source§impl SkillInjector
impl SkillInjector
pub fn from_root( root: impl AsRef<Path>, config: SkillInjectorConfig, ) -> SkillResult<Self>
pub fn from_index(index: SkillIndex, config: SkillInjectorConfig) -> Self
Sourcepub fn reloaded(&self) -> SkillResult<Self>
pub fn reloaded(&self) -> SkillResult<Self>
Rescans the root and returns an injector over the refreshed index.
The index is snapshotted at construction, so a skill written after this injector was built
— by SkillWriter, or by anything else on disk — is invisible to it.
This returns a new injector rather than mutating in place because
build_plugin captures the index by handle: a plugin already handed
to a runner keeps using the index it was built from. To pick up new skills, call this and
then rebuild the plugin from the result.
§Errors
Returns SkillError::Validation if this injector was
built with from_index and so has no root to rescan, or a load error
if rescanning fails.
§Example
ⓘ
let injector = injector.reloaded()?;
let plugin = injector.build_plugin("skills");Sourcepub fn root(&self) -> Option<&Path>
pub fn root(&self) -> Option<&Path>
The root this injector rescans, when it was built from one.
pub fn index(&self) -> &SkillIndex
pub fn policy(&self) -> &SelectionPolicy
pub fn max_injected_chars(&self) -> usize
pub fn build_plugin(&self, name: impl Into<String>) -> Plugin
pub fn build_plugin_manager(&self, name: impl Into<String>) -> PluginManager
Trait Implementations§
Source§impl Clone for SkillInjector
impl Clone for SkillInjector
Source§fn clone(&self) -> SkillInjector
fn clone(&self) -> SkillInjector
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SkillInjector
impl RefUnwindSafe for SkillInjector
impl Send for SkillInjector
impl Sync for SkillInjector
impl Unpin for SkillInjector
impl UnsafeUnpin for SkillInjector
impl UnwindSafe for SkillInjector
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