Skip to main content

market_subscribe_waits_for_the_stream

Function market_subscribe_waits_for_the_stream 

Source
pub async fn market_subscribe_waits_for_the_stream<'a, M, D, DFut, R, RFut>(
    md: &'a M,
    rx: &mut Receiver<Envelope>,
    id: &'a InstrumentId,
    drive: D,
    release: R,
)
where M: OrderBookSource + ?Sized, D: FnMut(SubscribeCall<'a>) -> DFut, DFut: Future<Output = Result<SubscriptionId, Error>> + 'a, R: FnOnce() -> RFut, RFut: Future<Output = ()>,
Expand description

subscribe_order_book returns when the stream is open, and a stream that does not open is an error.

The adapter holds the opening of the stream at the broker (the mock’s stream_gate, or md_silent at T-Bank). Then:

  1. drive runs the subscribe_order_book future to its end while the broker holds the stream and the clock moves past the connector’s wait. The outcome is [Error::Transport], not Ok.
  2. release lets the broker open the stream.
  3. The call is repeated and succeeds, and a book arrives on the new subscription: the failed call left nothing behind that blocks it.

§Panics

With [conformance:market_subscribe_waits_for_the_stream] <reason>.