pub struct ConnectOptions {
pub block_async_connect: bool,
pub strategy: ConnectStrategy,
pub url: Option<String>,
pub connect_timeout: Option<Duration>,
pub retry_interval: Option<Duration>,
}Expand description
ConnectOptions is used to configure the WebSocket connectivity behavior.
@category WebSocket
Fields§
§block_async_connect: boolIndicates if the async fn connect() method should return immediately
or block until the connection is established.
strategy: ConnectStrategyConnectStrategy used to configure the retry or fallback behavior.
url: Option<String>Optional url that will change the current URL of the WebSocket.
Note that the URL overrides the use of resolver.
connect_timeout: Option<Duration>Optional timeout that will change the timeout of the WebSocket connection process.
Timeout is the period after which the async connection attempt is aborted. Timeout
is followed by the retry delay if the ConnectionStrategy is set to Retry.
retry_interval: Option<Duration>Retry interval denotes the time to wait before attempting to reconnect.
Implementations§
Source§impl ConnectOptions
impl ConnectOptions
Sourcepub fn blocking_fallback() -> Self
pub fn blocking_fallback() -> Self
Options that block connect() until the first connection attempt
completes, returning on failure using ConnectStrategy::Fallback.
Sourcepub fn blocking_retry() -> Self
pub fn blocking_retry() -> Self
Options that block connect() until the connection is established,
continuously retrying using ConnectStrategy::Retry.
Sourcepub fn non_blocking_retry() -> Self
pub fn non_blocking_retry() -> Self
Options that return from connect() immediately while retrying
the connection in the background using ConnectStrategy::Retry.
Sourcepub fn with_url<S: Display>(self, url: S) -> Self
pub fn with_url<S: Display>(self, url: S) -> Self
Sets a custom URL that overrides the current WebSocket URL (and the resolver).
Sourcepub fn with_connect_timeout(self, timeout: Duration) -> Self
pub fn with_connect_timeout(self, timeout: Duration) -> Self
Sets the connection timeout after which a connection attempt is aborted.
Sourcepub fn with_retry_interval(self, interval: Duration) -> Self
pub fn with_retry_interval(self, interval: Duration) -> Self
Sets the retry interval to wait before attempting to reconnect.
Sourcepub fn connect_timeout(&self) -> Duration
pub fn connect_timeout(&self) -> Duration
Returns the configured connection timeout, or the default
(DEFAULT_CONNECT_TIMEOUT_MILLIS) if none was set.
Sourcepub fn retry_interval(&self) -> Duration
pub fn retry_interval(&self) -> Duration
Returns the configured retry interval, or the default
(DEFAULT_CONNECT_RETRY_MILLIS) if none was set.
Trait Implementations§
Source§impl Clone for ConnectOptions
impl Clone for ConnectOptions
Source§fn clone(&self) -> ConnectOptions
fn clone(&self) -> ConnectOptions
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 ConnectOptions
impl Debug for ConnectOptions
Auto Trait Implementations§
impl Freeze for ConnectOptions
impl RefUnwindSafe for ConnectOptions
impl Send for ConnectOptions
impl Sync for ConnectOptions
impl Unpin for ConnectOptions
impl UnsafeUnpin for ConnectOptions
impl UnwindSafe for ConnectOptions
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
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.