Struct ProviderLoader

Source
pub struct ProviderLoader {
    libraries: RwLock<Vec<Library>>,
}
Expand description

Provider loader manages dynamic loading of provider libraries

Fields§

§libraries: RwLock<Vec<Library>>

Loaded libraries (kept alive)

Implementations§

Source§

impl ProviderLoader

Source

pub fn new() -> Self

Create a new provider loader

Source

pub async fn load_from_directory<P: AsRef<Path>>( &self, directory: P, context: Arc<dyn ProviderContext>, ) -> ProviderResult<Vec<(Arc<dyn Provider>, ProviderMetadata)>>

Load providers from a directory

Source

pub async fn load_from_directory_with_registry<P: AsRef<Path>>( &self, directory: P, context: Arc<dyn ProviderContext>, event_registry: Option<Arc<EventRegistry>>, ) -> ProviderResult<Vec<(Arc<dyn Provider>, ProviderMetadata)>>

Load providers from a directory with optional event registry

Source

pub async fn load_features_from_directory<P: AsRef<Path>>( &self, directory: P, ) -> ProviderResult<Vec<FeatureInterface>>

Load feature interfaces from a directory (does not register as callable providers)

Source

fn is_provider_library(&self, path: &Path) -> bool

Check if a file is a provider library

Source

pub async fn load_provider_from_file<P: AsRef<Path>>( &self, library_path: P, context: Arc<dyn ProviderContext>, ) -> ProviderResult<(Arc<dyn Provider>, ProviderMetadata)>

Load a provider from a specific file

Source

pub async fn load_provider_from_file_with_registry<P: AsRef<Path>>( &self, library_path: P, context: Arc<dyn ProviderContext>, event_registry: Option<Arc<EventRegistry>>, ) -> ProviderResult<(Arc<dyn Provider>, ProviderMetadata)>

Load a provider from a specific file with optional event registry

Source

fn detect_provider_type(&self, lib: &Library) -> ProviderResult<ProviderType>

Detect what type of provider this library contains

Source

pub async fn load_feature_interface_from_file<P: AsRef<Path>>( &self, library_path: P, ) -> ProviderResult<FeatureInterface>

Load a feature interface from a specific file

Source

async fn load_legacy_cpi( &self, lib: &Library, library_path: &Path, context: Arc<dyn ProviderContext>, event_registry: Option<Arc<EventRegistry>>, ) -> ProviderResult<(Arc<dyn Provider>, ProviderMetadata)>

Load a legacy CPI and wrap it as a provider

Source

async fn load_modern_provider( &self, lib: &Library, library_path: &Path, context: Arc<dyn ProviderContext>, event_registry: Option<Arc<EventRegistry>>, ) -> ProviderResult<(Arc<dyn Provider>, ProviderMetadata)>

Load a modern provider

Source

async fn load_feature_as_provider( &self, lib: &Library, library_path: &Path, context: Arc<dyn ProviderContext>, ) -> ProviderResult<(Arc<dyn Provider>, ProviderMetadata)>

Load a feature and wrap it as a provider

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.

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