Struct barter_data::streams::builder::multi::MultiStreamBuilder
source · pub struct MultiStreamBuilder<Output> {
pub channels: HashMap<ExchangeId, ExchangeChannel<Output>>,
pub futures: Vec<BuilderInitFuture>,
}Expand description
Builder to configure and initialise a common Streams<Output> instance from
multiple StreamBuilder<SubscriptionKind>s.
Fields§
§channels: HashMap<ExchangeId, ExchangeChannel<Output>>§futures: Vec<BuilderInitFuture>Implementations§
source§impl<Output> MultiStreamBuilder<Output>
impl<Output> MultiStreamBuilder<Output>
sourcepub fn add<Kind>(self, builder: StreamBuilder<Kind>) -> Selfwhere
Output: From<MarketEvent<Instrument, Kind::Event>> + Send + 'static,
Kind: SubscriptionKind + 'static,
Kind::Event: Send,
pub fn add<Kind>(self, builder: StreamBuilder<Kind>) -> Selfwhere
Output: From<MarketEvent<Instrument, Kind::Event>> + Send + 'static,
Kind: SubscriptionKind + 'static,
Kind::Event: Send,
Add a StreamBuilder<SubscriptionKind> to the MultiStreamBuilder. Creates a
Future that calls StreamBuilder::init and maps the SubscriptionKind::Event
into a common Output.
Note that the created Future is not awaited until the MultiStreamBuilder::init
method is invoked.
sourcepub async fn init(self) -> Result<Streams<Output>, DataError>
pub async fn init(self) -> Result<Streams<Output>, DataError>
Initialise each StreamBuilder<SubscriptionKind> that was added to the
MultiStreamBuilder and map all Streams<SubscriptionKind::Event> into a common
Streams<Output>.
Trait Implementations§
source§impl<Output> Debug for MultiStreamBuilder<Output>where
Output: Debug,
impl<Output> Debug for MultiStreamBuilder<Output>where
Output: Debug,
source§impl<Output: Default> Default for MultiStreamBuilder<Output>
impl<Output: Default> Default for MultiStreamBuilder<Output>
source§fn default() -> MultiStreamBuilder<Output>
fn default() -> MultiStreamBuilder<Output>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<Output> Freeze for MultiStreamBuilder<Output>
impl<Output> !RefUnwindSafe for MultiStreamBuilder<Output>
impl<Output> !Send for MultiStreamBuilder<Output>
impl<Output> !Sync for MultiStreamBuilder<Output>
impl<Output> Unpin for MultiStreamBuilder<Output>
impl<Output> !UnwindSafe for MultiStreamBuilder<Output>
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