pub struct MarginStream { /* private fields */ }Expand description
Margin events of one account, in the order the server sent them.
The stream starts with the first event that arrives after it was created and goes on across reconnections; events the server sent while the connection was down are not sent again.
A stream that is read too slowly loses events: the connection holds a limited number of
them, set with
ConnectionOptions::event_capacity.
The loss is reported once by MarginStream::next with ConnectorError::Lagged and the
stream then goes on with the oldest event still held.
Implementations§
Source§impl MarginStream
impl MarginStream
Sourcepub async fn next(&mut self) -> Result<MarginEvent, ConnectorError>
pub async fn next(&mut self) -> Result<MarginEvent, ConnectorError>
Waits for the next margin event of the account.
§Errors
Returns ConnectorError::Closed when the connection is shut down,
ConnectorError::SessionEnded when the server ended the authorisation of the account,
ConnectorError::Lagged when events were dropped because the stream was read too
slowly, and ConnectorError::Value when the server sends a value out of range; the
stream can be read on after the last two.