pub struct Component<TMessage, TConfig> {
    pub input: Option<ComponentInput<TMessage>>,
    pub output: Option<ComponentOutput<TMessage>>,
    pub config: Option<TConfig>,
    pub function: Box<dyn IComponentFunction<TMessage, TConfig>>,
    /* private fields */
}
Expand description

Обобщенный компонент

Fields§

§input: Option<ComponentInput<TMessage>>§output: Option<ComponentOutput<TMessage>>§config: Option<TConfig>§function: Box<dyn IComponentFunction<TMessage, TConfig>>

Implementations§

source§

impl<TMessage, TConfig> Component<TMessage, TConfig>

source

pub fn new( config: TConfig, func: impl IComponentFunction<TMessage, TConfig> + 'static ) -> Self

Trait Implementations§

source§

impl<TMessage, TConfig> IComponent<TMessage> for Component<TMessage, TConfig>

source§

fn set_input(&mut self, stream_input: ComponentInput<TMessage>)

Задать входной поток
source§

fn set_output(&mut self, stream_output: ComponentOutput<TMessage>)

Задать выходной поток
source§

fn set_cache(&mut self, cache: CacheType<TMessage>)

source§

fn spawn(&mut self) -> JoinHandle<()>

Порождаем асинхронную задачу
source§

fn set_and_spawn( &mut self, input: ComponentInput<TMessage>, output: ComponentOutput<TMessage> ) -> JoinHandle<()>

Задать входной и выходной потоки и запустить на выполнение

Auto Trait Implementations§

§

impl<TMessage, TConfig> !RefUnwindSafe for Component<TMessage, TConfig>

§

impl<TMessage, TConfig> Send for Component<TMessage, TConfig>
where TConfig: Send, TMessage: Send + Sync,

§

impl<TMessage, TConfig> !Sync for Component<TMessage, TConfig>

§

impl<TMessage, TConfig> Unpin for Component<TMessage, TConfig>
where TConfig: Unpin,

§

impl<TMessage, TConfig> !UnwindSafe for Component<TMessage, TConfig>

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

§

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

§

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.