Skip to main content

PluginRegistry

Struct PluginRegistry 

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

Explicit plugin registry.

Implementations§

Source§

impl PluginRegistry

Source

pub const fn new() -> Self

Creates an empty registry.

Source

pub fn register_plugin<P: QrPlugin + ?Sized>(&mut self, plugin: &P)

Registers all extension points provided by plugin.

Source

pub fn register_renderer( &mut self, name: impl Into<String>, factory: Box<dyn RendererFactory>, ) -> Option<Box<dyn RendererFactory>>

Registers or replaces a renderer factory by name.

Source

pub fn register_encoder( &mut self, name: impl Into<String>, factory: Box<dyn EncoderFactory>, ) -> Option<Box<dyn EncoderFactory>>

Registers or replaces an encoder factory by name.

Source

pub fn register_postprocessor(&mut self, postprocessor: Box<dyn PostProcessor>)

Appends a postprocessor to the registry.

Source

pub fn renderer(&self, name: &str) -> Option<&dyn RendererFactory>

Returns a renderer factory by name.

Source

pub fn build_renderer( &self, name: &str, config: &RenderConfig, ) -> Result<Box<dyn DynRenderer>, PluginError>

Builds a renderer by name.

§Errors

Returns PluginError::RendererNotFound when no renderer factory is registered with name.

Source

pub fn encoder(&self, name: &str) -> Option<&dyn EncoderFactory>

Returns an encoder factory by name.

Source

pub fn build_encoder( &self, name: &str, config: &EncodeConfig, ) -> Result<Box<dyn DynEncoder>, PluginError>

Builds an encoder by name.

§Errors

Returns PluginError::EncoderNotFound when no encoder factory is registered with name.

Source

pub fn postprocessors(&self) -> &[Box<dyn PostProcessor>]

Returns all postprocessors in registration order.

Source

pub fn process_modules( &self, modules: &mut dyn ModuleStorage, ) -> Result<(), PluginError>

Applies all registered postprocessors in registration order.

§Errors

Returns the first PluginError reported by a postprocessor.

Source

pub fn renderer_names(&self) -> impl Iterator<Item = &str>

Iterates renderer names in deterministic order.

Source

pub fn encoder_names(&self) -> impl Iterator<Item = &str>

Iterates encoder names in deterministic order.

Trait Implementations§

Source§

impl Default for PluginRegistry

Source§

fn default() -> PluginRegistry

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.

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.