Enum renoir::operator::StreamElement

source ·
pub enum StreamElement<Out> {
    Item(Out),
    Timestamped(Out, Timestamp),
    Watermark(Timestamp),
    FlushBatch,
    Terminate,
    FlushAndRestart,
}
Expand description

An element of the stream. This is what enters and exits from the operators.

An operator may need to change the content of a StreamElement (e.g. a Map may change the value of the Item). Usually Watermark and FlushAndRestart are simply forwarded to the next operator in the chain.

In general a stream may be composed of a sequence of this kind:

((Item | Timestamped | Watermark | FlushBatch)* FlushAndRestart)+ Terminate

Variants§

§

Item(Out)

A normal element containing just the value of the message.

§

Timestamped(Out, Timestamp)

Like Item, but it’s attached with a timestamp, it’s used to ensure the ordering of the messages.

§

Watermark(Timestamp)

When an operator receives a Watermark with timestamp t, the operator will never see any message with timestamp less or equal to t.

§

FlushBatch

Flush the internal batch since there will be too much delay till the next message to come.

§

Terminate

The stream has ended, and the operators should exit as soon as possible.

No messages should be generated by the operator between a FlushAndRestart and a Terminate.

§

FlushAndRestart

Mark the end of a stream of data.

Note that this does not mean that the entire stream has ended, for example this is used to mark the end of an iteration. Therefore an operator may be prepared to received new data after this message, but should not retain the internal state.

Implementations§

source§

impl<Out> StreamElement<Out>

source

pub fn variant(&self) -> StreamElement<()>

Create a new StreamElement with an Item(()) if self contains an item, otherwise it returns the same variant of self.

source

pub fn map<NewOut>(self, f: impl FnOnce(Out) -> NewOut) -> StreamElement<NewOut>

Change the type of the element inside the StreamElement.

source

pub fn variant_str(&self) -> &'static str

A string representation of the variant of this StreamElement.

source

pub fn timestamp(&self) -> Option<&Timestamp>

A string representation of the variant of this StreamElement.

source

pub fn add_key<Key>(self, k: Key) -> StreamElement<(Key, Out)>

source

pub fn value(&self) -> Option<&Out>

source§

impl<Key, Out> StreamElement<(Key, Out)>

source

pub fn take_key(self) -> (Option<Key>, StreamElement<Out>)

Map a StreamElement<KeyValue(Key, Out)> to a StreamElement<Out>, returning the key if possible

source

pub fn key(self) -> Option<Key>

Trait Implementations§

source§

impl<Out: Clone> Clone for StreamElement<Out>

source§

fn clone(&self) -> StreamElement<Out>

Returns a copy 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<Out: Debug> Debug for StreamElement<Out>

source§

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

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

impl<'de, Out> Deserialize<'de> for StreamElement<Out>
where Out: Deserialize<'de>,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T> From<WindowResult<T>> for StreamElement<T>

source§

fn from(value: WindowResult<T>) -> Self

Converts to this type from the input type.
source§

impl<Out: Ord> Ord for StreamElement<Out>

source§

fn cmp(&self, other: &StreamElement<Out>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<Out: PartialEq> PartialEq for StreamElement<Out>

source§

fn eq(&self, other: &StreamElement<Out>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Out: PartialOrd> PartialOrd for StreamElement<Out>

source§

fn partial_cmp(&self, other: &StreamElement<Out>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<Out> Serialize for StreamElement<Out>
where Out: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<Out: Eq> Eq for StreamElement<Out>

source§

impl<Out> StructuralPartialEq for StreamElement<Out>

Auto Trait Implementations§

§

impl<Out> Freeze for StreamElement<Out>
where Out: Freeze,

§

impl<Out> RefUnwindSafe for StreamElement<Out>
where Out: RefUnwindSafe,

§

impl<Out> Send for StreamElement<Out>
where Out: Send,

§

impl<Out> Sync for StreamElement<Out>
where Out: Sync,

§

impl<Out> Unpin for StreamElement<Out>
where Out: Unpin,

§

impl<Out> UnwindSafe for StreamElement<Out>
where Out: UnwindSafe,

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
§

impl<T> CloneDebuggableStorage for T
where T: DebuggableStorage + Clone,

§

fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>

source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> CloneableStorage for T
where T: Any + Send + Sync + Clone,

§

fn clone_storage(&self) -> Box<dyn CloneableStorage>

§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

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

§

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> Data for T
where T: Clone + Send + 'static,

§

impl<T> DebuggableStorage for T
where T: Any + Send + Sync + Debug,

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> ExchangeData for T
where T: Serialize + for<'a> Deserialize<'a> + Clone + Send + 'static,