Skip to main content

PluginLoader

Struct PluginLoader 

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

Loader for plug-in cdylibs.

Owns every Library for the lifetime of the live node, since v1 does not support dlclose. Caller walks the returned LoadedPlugin manifests to register entries into the relevant runtime registries.

Implementations§

Source§

impl PluginLoader

Source

pub fn new() -> Self

Creates a new, empty loader that hands every plug-in the default nautilus-plugin host vtable. The default vtable carries NotImplemented stubs for stateful host callbacks; use PluginLoader::with_host to install a live-node vtable.

Source

pub fn with_host(host: *const HostVTable) -> Self

Creates a new, empty loader that will hand every loaded plug-in the supplied host vtable instead of the default.

host must remain live for the lifetime of every plug-in loaded through this loader (typically the process lifetime).

Source

pub fn load_all<P>( &mut self, paths: impl IntoIterator<Item = P>, ) -> Result<(), LoadError>
where P: AsRef<OsStr>,

Loads every plug-in path in order. Stops on the first error.

Source

pub fn load( &mut self, path: impl AsRef<OsStr>, ) -> Result<&LoadedPlugin, LoadError>

Loads a single plug-in cdylib.

Source

pub fn loaded(&self) -> &[LoadedPlugin]

Returns every loaded plug-in in load order.

Source

pub fn len(&self) -> usize

Returns the number of loaded plug-ins.

Source

pub fn is_empty(&self) -> bool

Returns whether no plug-ins have been loaded.

Trait Implementations§

Source§

impl Debug for PluginLoader

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for PluginLoader

Source§

fn default() -> PluginLoader

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

impl Send for PluginLoader

SAFETY: *const HostVTable is a process-lifetime static pointer; the host commits to keeping the vtable live and the inner fn pointers are Sync by construction.

Source§

impl Sync for PluginLoader

SAFETY: see above.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.