pub struct QuoteStream { /* private fields */ }Expand description
A handle to an active quote stream.
When dropped, automatically sends StopStream to the server.
Implementations§
Source§impl QuoteStream
impl QuoteStream
Sourcepub fn new(
stream_id: u32,
receiver: Receiver<SwapQuotes>,
connection: Arc<Connection>,
) -> Self
pub fn new( stream_id: u32, receiver: Receiver<SwapQuotes>, connection: Arc<Connection>, ) -> Self
Create a new quote stream handle (unmanaged, for backwards compatibility).
Sourcepub fn new_managed(
stream_id: u32,
receiver: Receiver<SwapQuotes>,
connection: Arc<Connection>,
manager: Option<Arc<StreamManager>>,
) -> Self
pub fn new_managed( stream_id: u32, receiver: Receiver<SwapQuotes>, connection: Arc<Connection>, manager: Option<Arc<StreamManager>>, ) -> Self
Create a new managed quote stream handle.
Sourcepub async fn recv(&mut self) -> Option<SwapQuotes>
pub async fn recv(&mut self) -> Option<SwapQuotes>
Receive the next quote update.
Returns None when the stream ends.
Sourcepub async fn stop(&mut self) -> Result<(), TitanClientError>
pub async fn stop(&mut self) -> Result<(), TitanClientError>
Explicitly stop the stream.
This is called automatically on drop, but can be called manually if you want to handle the result.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QuoteStream
impl !RefUnwindSafe for QuoteStream
impl Send for QuoteStream
impl Sync for QuoteStream
impl Unpin for QuoteStream
impl !UnwindSafe for QuoteStream
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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