pub enum StreamItem<T> {
Value(T),
Error(FluxionError),
}Expand description
A stream item that can be either a value or an error.
This enum allows operators to naturally propagate errors through the stream while processing values, following Rx-style error semantics where errors are propagated and do NOT terminate the stream
Variants§
Value(T)
A successful value
Error(FluxionError)
An error that does not terminate the stream (it only gets propagated)
Implementations§
Source§impl<T> StreamItem<T>
impl<T> StreamItem<T>
Sourcepub fn err(self) -> Option<FluxionError>
pub fn err(self) -> Option<FluxionError>
Converts from StreamItem<T> to Option<FluxionError>, discarding values.
Sourcepub fn map<U, F>(self, f: F) -> StreamItem<U>where
F: FnOnce(T) -> U,
pub fn map<U, F>(self, f: F) -> StreamItem<U>where
F: FnOnce(T) -> U,
Maps a StreamItem<T> to StreamItem<U> by applying a function to the contained value.
Errors are propagated unchanged.
Sourcepub fn and_then<U, F>(self, f: F) -> StreamItem<U>where
F: FnOnce(T) -> StreamItem<U>,
pub fn and_then<U, F>(self, f: F) -> StreamItem<U>where
F: FnOnce(T) -> StreamItem<U>,
Maps a StreamItem<T> to StreamItem<U> by applying a function that can fail.
Errors are propagated unchanged.
Sourcepub fn unwrap(self) -> Twhere
FluxionError: Debug,
pub fn unwrap(self) -> Twhere
FluxionError: Debug,
Trait Implementations§
Source§impl<T: Clone> Clone for StreamItem<T>
impl<T: Clone> Clone for StreamItem<T>
Source§fn clone(&self) -> StreamItem<T>
fn clone(&self) -> StreamItem<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for StreamItem<T>
impl<T: Debug> Debug for StreamItem<T>
Source§impl<T> From<Result<T, FluxionError>> for StreamItem<T>
impl<T> From<Result<T, FluxionError>> for StreamItem<T>
Source§fn from(result: Result<T, FluxionError>) -> Self
fn from(result: Result<T, FluxionError>) -> Self
Converts to this type from the input type.
Source§impl<T> From<StreamItem<T>> for Result<T, FluxionError>
impl<T> From<StreamItem<T>> for Result<T, FluxionError>
Source§fn from(item: StreamItem<T>) -> Self
fn from(item: StreamItem<T>) -> Self
Converts to this type from the input type.
Source§impl<T> HasTimestamp for StreamItem<T>where
T: Timestamped,
impl<T> HasTimestamp for StreamItem<T>where
T: Timestamped,
Source§impl<T: Ord> Ord for StreamItem<T>
impl<T: Ord> Ord for StreamItem<T>
Source§impl<T: PartialEq> PartialEq for StreamItem<T>
impl<T: PartialEq> PartialEq for StreamItem<T>
Source§impl<T: PartialOrd> PartialOrd for StreamItem<T>
impl<T: PartialOrd> PartialOrd for StreamItem<T>
Source§impl<T> Timestamped for StreamItem<T>where
T: Timestamped,
impl<T> Timestamped for StreamItem<T>where
T: Timestamped,
Source§type Inner = <T as Timestamped>::Inner
type Inner = <T as Timestamped>::Inner
The type of the inner value wrapped by this timestamped type
Source§fn with_timestamp(value: Self::Inner, timestamp: Self::Timestamp) -> Self
fn with_timestamp(value: Self::Inner, timestamp: Self::Timestamp) -> Self
Creates a new instance wrapping the given value with the specified timestamp.
Source§fn into_inner(self) -> Self::Inner
fn into_inner(self) -> Self::Inner
Consumes self and returns the inner value.
For wrapper types like
Sequenced<T>, this extracts T.
For domain types where Inner = Self, this typically returns self.impl<T: Eq> Eq for StreamItem<T>
Auto Trait Implementations§
impl<T> Freeze for StreamItem<T>where
T: Freeze,
impl<T> RefUnwindSafe for StreamItem<T>where
T: RefUnwindSafe,
impl<T> Send for StreamItem<T>where
T: Send,
impl<T> Sync for StreamItem<T>where
T: Sync,
impl<T> Unpin for StreamItem<T>where
T: Unpin,
impl<T> UnwindSafe for StreamItem<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more