Skip to main content

Injector

Trait Injector 

Source
pub trait Injector {
    type InputItem;
    type Inner: Injector;
    type Context;

    // Required methods
    fn new(injector: Self::Inner, data: Self::Context) -> Self;
    fn inner(&self) -> &Self::Inner;
    fn wrap(
        &self,
        item: Self::InputItem,
    ) -> Result<<Self::Inner as Injector>::InputItem, WorkerError>;

    // Provided method
    fn push(&self, item: Self::InputItem) -> Result<(), WorkerError> { ... }
}

Required Associated Types§

Required Methods§

Source

fn new(injector: Self::Inner, data: Self::Context) -> Self

Source

fn inner(&self) -> &Self::Inner

Source

fn wrap( &self, item: Self::InputItem, ) -> Result<<Self::Inner as Injector>::InputItem, WorkerError>

Provided Methods§

Source

fn push(&self, item: Self::InputItem) -> Result<(), WorkerError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Injector for ()

Source§

type Context = ()

Source§

type Inner = ()

Source§

type InputItem = ()

Source§

fn inner(&self) -> &Self::Inner

Source§

fn new(_: Self::Inner, _: Self::Context) -> Self

Source§

fn wrap( &self, _: Self::InputItem, ) -> Result<<Self::Inner as Injector>::InputItem, WorkerError>

Implementors§

Source§

impl<I: Injector<InputItem = Either<String, Text<'static>>>> Injector for AnsiInjector<I>

Source§

impl<T, I: Injector<InputItem = Indexed<T>>> Injector for IndexedInjector<T, I>

Source§

impl<T, I: Injector<InputItem = Segmented<T>>> Injector for SegmentedInjector<T, I>

Source§

type InputItem = T

Source§

type Inner = I

Source§

type Context = Arc<dyn for<'a> Fn(&'a T) -> ArrayVec<(usize, usize), { crate::MAX_SPLITS }> + Send + Sync>

Source§

impl<T: SSS> Injector for WorkerInjector<T>