pub struct ClientConfig {
pub url: String,
pub token: Sensitive<String>,
pub name: String,
pub version: String,
pub data: Option<Vec<u8>>,
pub headers: FastMap<String, String>,
pub min_reconnect_delay: Duration,
pub max_reconnect_delay: Duration,
pub(super) get_token: Option<Arc<dyn Fn() -> Pin<Box<dyn Future<Output = Result<Sensitive<String>, Error>> + Send + 'static>> + Send + Sync>>,
}Expand description
Connection identity, authentication, and reconnect settings for a crate::Client.
Fields§
§url: String§token: Sensitive<String>§name: String§version: String§data: Option<Vec<u8>>§headers: FastMap<String, String>§min_reconnect_delay: Duration§max_reconnect_delay: Duration§get_token: Option<Arc<dyn Fn() -> Pin<Box<dyn Future<Output = Result<Sensitive<String>, Error>> + Send + 'static>> + Send + Sync>>Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn new(url: impl Into<String>, token: Sensitive<String>) -> Self
pub fn new(url: impl Into<String>, token: Sensitive<String>) -> Self
Creates connection settings for url authenticated with token.
Sourcepub fn name(self, name: impl Into<String>) -> Self
pub fn name(self, name: impl Into<String>) -> Self
Sets the client implementation name sent during the handshake.
Sourcepub fn version(self, version: impl Into<String>) -> Self
pub fn version(self, version: impl Into<String>) -> Self
Sets the client implementation version sent during the handshake.
Sourcepub fn headers(self, headers: FastMap<String, String>) -> Self
pub fn headers(self, headers: FastMap<String, String>) -> Self
Replaces all additional handshake headers.
Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
Source§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
Returns a duplicate of the value. Read more
1.0.0 · 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 ClientConfig
impl !RefUnwindSafe for ClientConfig
impl Send for ClientConfig
impl Sync for ClientConfig
impl Unpin for ClientConfig
impl UnsafeUnpin for ClientConfig
impl !UnwindSafe for ClientConfig
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
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