pub struct Config {
pub base_url: String,
pub api_key: Option<SensitiveString>,
pub api_secret: Option<SensitiveString>,
pub recv_window: Timestamp,
pub referer: Option<String>,
pub rate_limiter: Option<RateLimiterConfig>,
pub timeout: Option<Duration>,
pub connect_timeout: Option<Duration>,
}Fields§
§base_url: String§api_key: Option<SensitiveString>§api_secret: Option<SensitiveString>§recv_window: TimestampMilliseconds.
referer: Option<String>HTTP the header for broker users only.
rate_limiter: Option<RateLimiterConfig>Optional rate limiter. When Some, every request is pre-flight-checked
against a local token bucket and the last server-reported limit status.
Set to None to disable rate limiting entirely.
timeout: Option<Duration>Total timeout of one request (connect + send + receive).
None disables it, which is not recommended: a hung request would
then wait forever.
connect_timeout: Option<Duration>Timeout of establishing a connection. None disables it.
Implementations§
Source§impl Config
impl Config
Sourcepub fn new(base_url: impl Into<String>) -> Self
pub fn new(base_url: impl Into<String>) -> Self
Config for public endpoints with default timeouts and no rate limiter.
Sourcepub fn credentials(
self,
api_key: impl Into<SensitiveString>,
api_secret: impl Into<SensitiveString>,
) -> Self
pub fn credentials( self, api_key: impl Into<SensitiveString>, api_secret: impl Into<SensitiveString>, ) -> Self
Credentials required by private endpoints.
Sourcepub fn recv_window(self, recv_window: Timestamp) -> Self
pub fn recv_window(self, recv_window: Timestamp) -> Self
Milliseconds.
pub fn referer(self, referer: impl Into<String>) -> Self
pub fn rate_limiter(self, rate_limiter: RateLimiterConfig) -> Self
pub fn timeout(self, timeout: Option<Duration>) -> Self
pub fn connect_timeout(self, connect_timeout: Option<Duration>) -> Self
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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
Mutably borrows from an owned value. Read more