Skip to main content

PluginHost

Struct PluginHost 

Source
pub struct PluginHost { /* private fields */ }
Expand description

Composition point for the process-wide plugin + custom-function registries.

Each plugin crate exposes a register(&mut PluginHost) that adds its RegisteredPlugin and its custom functions to ONE host; the binary (e.g. waratah_bin/src/main.rs) then installs the composed host process-wide EXACTLY ONCE, before any QueryEngine exists. This is the fix for the first-install-wins trap: two self-installing plugins would silently drop the second plugin’s registry entries, and the loser would also have dropped the winner’s custom functions (each map starting from with_builtins()). Registration-time conflicts — a datatype IRI claimed by two plugins, a duplicate function IRI — error here, at the composition site, instead of silently no-op’ing at install time.

Implementations§

Source§

impl PluginHost

Source

pub fn new() -> Self

An empty host over the builtin XSD casts.

Source

pub fn registry_is_empty(&self) -> bool

Whether any plugin bundle is registered (test / composition checks).

Source

pub fn register(&mut self, plugin: RegisteredPlugin) -> Result<(), ComputeError>

Merge one plugin bundle into the shared registry. A datatype-IRI claim conflict with an already-registered plugin errors here (PluginRegistry::register).

Source

pub fn register_functions( &mut self, functions: Vec<CustomFunction>, ) -> Result<(), ComputeError>

Add custom functions to the ONE shared map (the builtin XSD casts are already on it). Duplicate IRIs error (CustomFunctions::register).

Source

pub fn install_process_wide(self)

Set BOTH process-wide registries from the composed host.

Builtins + every registered plugin’s functions live on one map: the engine’s own install is a no-op once this landed first (first install wins, both are correct registries). The underlying setters keep their first-wins semantics — a second install is a silent no-op — so this must be the process’s ONLY host install, and it must happen BEFORE any QueryEngine is constructed (the engine would otherwise install plain builtins on the custom-function map, after which plugin functions can never land).

Trait Implementations§

Source§

impl Default for PluginHost

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
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
§

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,

§

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