Skip to main content

PackRegistry

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

pub fn new() -> PackRegistry

A registry holding only the built-ins.

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)>

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)>

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

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Shows each Pack’s FQN, origin, and Pack id, and never its config, which may hold a credential such as a bearer token.

§

impl Default for PackRegistry

§

fn default() -> PackRegistry

A registry holding only the built-ins.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSync for T
where T: Sync,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more