pub struct BinanceConfig {
pub base_url: String,
pub read_timeout: Duration,
pub initial_reconnect_delay: Duration,
pub max_reconnect_backoff: Duration,
pub max_reconnect_attempts: u32,
pub max_message_size: usize,
pub max_frame_size: usize,
}live-binance only.Expand description
Tunable knobs for a BinanceKlineStream. The defaults match Binance’s
public production endpoint and are right for almost every caller; the
fields exist so an integration test or a Binance Testnet user can point
the stream at a different base URL and shrink the reconnect timing.
Fields§
§base_url: StringWebSocket endpoint without path (e.g. "wss://stream.binance.com:9443").
The combined-stream path /stream?streams=… is appended internally.
read_timeout: DurationMaximum time to wait for the next inbound frame before treating the connection as stalled. Binance pings roughly every 3 minutes, so a healthy but quiet stream stays comfortably inside the 300 s default.
initial_reconnect_delay: DurationDelay before the first reconnect attempt; doubles on each failure up
to Self::max_reconnect_backoff.
max_reconnect_backoff: DurationUpper bound on the exponential reconnect backoff.
max_reconnect_attempts: u32How many times BinanceKlineStream::next_event retries a dropped
connection before surfacing the last error. Must be >= 1.
max_message_size: usizeUpper bound on an inbound WebSocket message. Kline frames are tiny; this only caps a pathological or hostile server from forcing an unbounded allocation.
max_frame_size: usizeUpper bound on a single inbound WebSocket frame.
Trait Implementations§
Source§impl Clone for BinanceConfig
impl Clone for BinanceConfig
Source§fn clone(&self) -> BinanceConfig
fn clone(&self) -> BinanceConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BinanceConfig
impl Debug for BinanceConfig
Auto Trait Implementations§
impl Freeze for BinanceConfig
impl RefUnwindSafe for BinanceConfig
impl Send for BinanceConfig
impl Sync for BinanceConfig
impl Unpin for BinanceConfig
impl UnsafeUnpin for BinanceConfig
impl UnwindSafe for BinanceConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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