pub struct BinanceSpotPublicJsonWebSocketClient { /* private fields */ }Expand description
Binance Spot public JSON WebSocket client.
Implementations§
Source§impl BinanceSpotPublicJsonWebSocketClient
impl BinanceSpotPublicJsonWebSocketClient
Sourcepub fn new(
url: Option<String>,
heartbeat: Option<u64>,
transport_backend: TransportBackend,
) -> Self
pub fn new( url: Option<String>, heartbeat: Option<u64>, transport_backend: TransportBackend, ) -> Self
Creates a new Spot public JSON WebSocket client.
Sourcepub async fn close(&mut self) -> Result<()>
pub async fn close(&mut self) -> Result<()>
Closes all WebSocket connections and tasks.
§Errors
Returns an error if command delivery fails while shutting down.
Sourcepub async fn subscribe(&self, streams: Vec<String>) -> Result<()>
pub async fn subscribe(&self, streams: Vec<String>) -> Result<()>
Subscribes to stream names.
§Errors
Returns an error if command delivery fails or if the connection pool is exhausted.
Sourcepub fn stream(&self) -> impl Stream<Item = BinanceSpotPublicWsMessage> + 'static
pub fn stream(&self) -> impl Stream<Item = BinanceSpotPublicWsMessage> + 'static
Returns a stream of output messages.
Sourcepub fn cache_instruments(&self, instruments: &[InstrumentAny])
pub fn cache_instruments(&self, instruments: &[InstrumentAny])
Bulk initialize the instrument cache.
Sourcepub fn instruments_cache(&self) -> Arc<AtomicMap<Ustr, InstrumentAny>> ⓘ
pub fn instruments_cache(&self) -> Arc<AtomicMap<Ustr, InstrumentAny>> ⓘ
Returns a shared reference to the instruments cache.
Trait Implementations§
Source§impl Clone for BinanceSpotPublicJsonWebSocketClient
impl Clone for BinanceSpotPublicJsonWebSocketClient
Source§fn clone(&self) -> BinanceSpotPublicJsonWebSocketClient
fn clone(&self) -> BinanceSpotPublicJsonWebSocketClient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BinanceSpotPublicJsonWebSocketClient
impl RefUnwindSafe for BinanceSpotPublicJsonWebSocketClient
impl Send for BinanceSpotPublicJsonWebSocketClient
impl Sync for BinanceSpotPublicJsonWebSocketClient
impl Unpin for BinanceSpotPublicJsonWebSocketClient
impl UnsafeUnpin for BinanceSpotPublicJsonWebSocketClient
impl UnwindSafe for BinanceSpotPublicJsonWebSocketClient
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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