Struct PackRegistry
pub struct PackRegistry { /* private fields */ }Expand description
Every Pack a Host’s Plugins insert, by fully qualified name, each with its Pack id and config.
The Host owns the registry; a Plugin only inserts its Packs into it,
by calling insert from its install
function. The Host makes the registry with
new, which holds the built-ins such as
runvil/subagents from the start, and calls each Plugin it links. Then
it hands the registry to HostContext::new, which reads it through
into_entries and calls each Pack’s
construct once, at startup, to make the one Pack object every run
shares.
Implementations§
§impl PackRegistry
impl PackRegistry
pub fn new() -> PackRegistry
pub fn new() -> PackRegistry
A registry holding only the built-ins.
pub fn insert(
&mut self,
info: PackInfo,
config: Value,
) -> Result<(), InstallError>
pub fn insert( &mut self, info: PackInfo, config: Value, ) -> Result<(), InstallError>
Inserts info as a linked Pack with config, which its construct
receives when the Host builds it.
The Pack id is the FQN’s second segment, so runvil/web is web,
and the registry may hold Packs of different vendors with the same
Pack id, such as runvil/web and acme/web.
§Errors
Returns InstallError::InvalidFqn when the FQN is not a
vendor/name pair of valid one-segment names,
InstallError::DuplicatePack when the registry holds the FQN
already, as it holds each built-in’s from the start, and
InstallError::ReservedName when the Pack id is a built-in’s.
pub fn list(&self) -> impl Iterator<Item = (&PackInfo, PackOrigin)>
pub fn list(&self) -> impl Iterator<Item = (&PackInfo, PackOrigin)>
Every Pack the registry holds, built-ins included, with its origin, in FQN order.
pub fn into_entries(self) -> impl Iterator<Item = (PackInfo, PackId, Value)>
pub fn into_entries(self) -> impl Iterator<Item = (PackInfo, PackId, Value)>
Every Pack the registry holds, built-ins included, with its Pack id and its config, in FQN order: what a Host builds its Packs from.
Trait Implementations§
§impl Debug for PackRegistry
impl Debug for PackRegistry
§impl Default for PackRegistry
impl Default for PackRegistry
§fn default() -> PackRegistry
fn default() -> PackRegistry
A registry holding only the built-ins.
Auto Trait Implementations§
impl Freeze for PackRegistry
impl RefUnwindSafe for PackRegistry
impl Send for PackRegistry
impl Sync for PackRegistry
impl Unpin for PackRegistry
impl UnsafeUnpin for PackRegistry
impl UnwindSafe for PackRegistry
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more