Skip to main content

PluginRegistryBuilder

Struct PluginRegistryBuilder 

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

Fluent builder for constructing a PluginRegistry at application startup.

§Example

ⓘ
let registry = PluginRegistryBuilder::new()
    .with_dialect("postgres", Arc::new(PostgresDialect))
    .with_llm("ollama".into(), Arc::new(OllamaFactory::new()))
    .with_auto_discovered()
    .build();

Implementations§

Source§

impl PluginRegistryBuilder

Source

pub fn new() -> Self

Create a new empty builder.

Source

pub fn with_dialect(self, name: &str, dialect: Arc<dyn PlatformDialect>) -> Self

Register a dialect by its canonical string name.

Source

pub fn with_storage( self, platform: StoragePlatform, factory: Arc<dyn StorageProviderFactory>, ) -> Self

Register a storage provider for a known (enum) storage platform.

Source

pub fn with_storage_extension( self, name: String, factory: Arc<dyn StorageProviderFactory>, ) -> Self

Register a storage provider for an extension (string-named) platform.

Source

pub fn with_llm(self, name: String, factory: Arc<dyn LlmClientFactory>) -> Self

Register an LLM provider factory by name.

Source

pub fn with_model(self, adapter: Arc<dyn LlmModelAdapter>) -> Self

Register a model adapter (keyed by provider + model_id).

Source

pub fn with_language( self, language: String, factory: Arc<dyn LanguageRendererFactory>, ) -> Self

Register a language renderer factory by language name.

Source

pub fn with_event_sink(self, sink: Arc<dyn EventSink>) -> Self

Register an event sink for observability.

Source

pub fn with_auto_discovered(self) -> Self

Discover and register all plugins submitted via inventory::submit!.

Source

pub fn with_dynamic_plugins(self, plugin_dir: &Path) -> Self

Discover and load all plugin shared libraries from plugin_dir.

Scans the directory for .so/.dylib/.dll files, checks their API version, and calls their registration function. Invalid or incompatible plugins are logged and skipped.

Requires the dynamic feature. Native-only: shared-library loading does not exist on wasm32-unknown-unknown (a browser cannot dlopen .sos).

Source

pub fn build(self) -> PluginRegistry

Consume the builder and produce the final PluginRegistry.

Trait Implementations§

Source§

impl Default for PluginRegistryBuilder

Source§

fn default() -> Self

Create a fresh plugin-registry builder with empty sub-registries. Parameters:

  • none: Returns a new builder equivalent to PluginRegistryBuilder::new().

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.

Source§

impl<T> Instrument for T

Source§

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

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

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> WithSubscriber for T

Source§

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

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

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