VecConsumer

Struct VecConsumer 

Source
pub struct VecConsumer<T>
where T: Debug + Clone + Send + Sync + 'static,
{ pub vec: Vec<T>, pub config: ConsumerConfig<T>, }
Expand description

A consumer that collects items into a Vec.

This consumer collects all items from the stream into an internal Vec, preserving the order in which they were received.

Fields§

§vec: Vec<T>

The internal Vec where items are collected.

§config: ConsumerConfig<T>

Configuration for the consumer, including error handling strategy.

Implementations§

Source§

impl<T> VecConsumer<T>
where T: Debug + Clone + Send + Sync + 'static,

Source

pub fn new() -> Self

Creates a new VecConsumer with an empty Vec.

Source

pub fn with_capacity(capacity: usize) -> Self

Creates a new VecConsumer with a pre-allocated Vec capacity.

§Arguments
  • capacity - The initial capacity of the internal Vec.
Source

pub fn with_error_strategy(self, strategy: ErrorStrategy<T>) -> Self

Sets the error handling strategy for this consumer.

§Arguments
  • strategy - The error handling strategy to use.
Source

pub fn with_name(self, name: String) -> Self

Sets the name for this consumer.

§Arguments
  • name - The name to assign to this consumer.
Source

pub fn into_vec(self) -> Vec<T>

Consumes the consumer and returns the collected Vec.

§Returns

The Vec containing all collected items in order.

Trait Implementations§

Source§

impl<T> Clone for VecConsumer<T>
where T: Debug + Clone + Send + Sync + 'static + Clone,

Source§

fn clone(&self) -> VecConsumer<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Consumer for VecConsumer<T>
where T: Debug + Clone + Send + Sync + 'static,

Source§

type InputPorts = (T,)

The input port tuple type for this consumer. Read more
Source§

fn consume<'life0, 'async_trait>( &'life0 mut self, stream: Self::InputStream, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Consumes a stream of items. Read more
Source§

fn set_config_impl(&mut self, config: ConsumerConfig<T>)

Internal implementation for setting configuration.
Source§

fn get_config_impl(&self) -> &ConsumerConfig<T>

Internal implementation for getting configuration.
Source§

fn get_config_mut_impl(&mut self) -> &mut ConsumerConfig<T>

Internal implementation for getting mutable configuration.
Source§

fn handle_error(&self, error: &StreamError<T>) -> ErrorAction

Handles an error according to the consumer’s error strategy. Read more
Source§

fn create_error_context(&self, item: Option<T>) -> ErrorContext<T>

Creates an error context for the given item. Read more
Source§

fn component_info(&self) -> ComponentInfo

Returns information about this consumer component.
Source§

fn with_config(&self, config: ConsumerConfig<Self::Input>) -> Self
where Self: Sized + Clone,

Creates a new consumer instance with the given configuration. Read more
Source§

fn set_config(&mut self, config: ConsumerConfig<Self::Input>)

Sets the configuration for this consumer. Read more
Source§

fn config(&self) -> &ConsumerConfig<Self::Input>

Returns a reference to the consumer’s configuration.
Source§

fn config_mut(&mut self) -> &mut ConsumerConfig<Self::Input>

Returns a mutable reference to the consumer’s configuration.
Source§

fn with_name(self, name: String) -> Self
where Self: Sized,

Sets the name for this consumer. Read more
Source§

impl<T> Default for VecConsumer<T>
where T: Debug + Clone + Send + Sync + 'static,

Source§

fn default() -> Self

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

impl<T> Input for VecConsumer<T>
where T: Debug + Clone + Send + Sync + 'static,

Source§

type Input = T

The type of items produced by this input stream.
Source§

type InputStream = Pin<Box<dyn Stream<Item = T> + Send>>

The input stream type that yields items of type Self::Input.

Auto Trait Implementations§

§

impl<T> Freeze for VecConsumer<T>

§

impl<T> !RefUnwindSafe for VecConsumer<T>

§

impl<T> Send for VecConsumer<T>

§

impl<T> Sync for VecConsumer<T>

§

impl<T> Unpin for VecConsumer<T>
where T: Unpin,

§

impl<T> !UnwindSafe for VecConsumer<T>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.