Struct barter_data::streams::Streams
source · pub struct Streams<T> {
pub streams: HashMap<ExchangeId, UnboundedReceiver<T>>,
}Expand description
Ergonomic collection of exchange MarketEvent<T> receivers.
Fields§
§streams: HashMap<ExchangeId, UnboundedReceiver<T>>Implementations§
source§impl<T> Streams<T>
impl<T> Streams<T>
sourcepub fn builder<Kind>() -> StreamBuilder<Kind>where
Kind: SubscriptionKind,
pub fn builder<Kind>() -> StreamBuilder<Kind>where
Kind: SubscriptionKind,
Construct a StreamBuilder for configuring new
MarketEvent<SubscriptionKind::Event> Streams.
sourcepub fn builder_multi() -> MultiStreamBuilder<T>
pub fn builder_multi() -> MultiStreamBuilder<T>
Construct a MultiStreamBuilder for configuring new
MarketEvent<T> Streams.
sourcepub fn select(&mut self, exchange: ExchangeId) -> Option<UnboundedReceiver<T>>
pub fn select(&mut self, exchange: ExchangeId) -> Option<UnboundedReceiver<T>>
Remove an exchange mpsc::UnboundedReceiver from the Streams HashMap.
sourcepub async fn join(self) -> UnboundedReceiver<T>where
T: Send + 'static,
pub async fn join(self) -> UnboundedReceiver<T>where
T: Send + 'static,
Join all exchange mpsc::UnboundedReceiver streams into a unified
mpsc::UnboundedReceiver.
sourcepub async fn join_map(self) -> StreamMap<ExchangeId, UnboundedReceiverStream<T>>
pub async fn join_map(self) -> StreamMap<ExchangeId, UnboundedReceiverStream<T>>
Join all exchange mpsc::UnboundedReceiver streams into a unified StreamMap.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Streams<T>
impl<T> !RefUnwindSafe for Streams<T>
impl<T> Send for Streams<T>where
T: Send,
impl<T> Sync for Streams<T>where
T: Send,
impl<T> Unpin for Streams<T>
impl<T> !UnwindSafe for Streams<T>
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more