pub struct ClientConfig { /* private fields */ }Expand description
Everything needed to open a session, checked and ready to use.
Build one with ClientConfig::builder; the fields are private so a
configuration that failed a check cannot exist. Hand it to
Client::connect.
§Examples
use std::time::Duration;
use lightstreamer_rs::{
AdapterSet, ClientConfig, ConnectionOptions, Credentials, ServerAddress,
};
let config = ClientConfig::builder(ServerAddress::try_new("wss://push.example.com")?)
.with_adapter_set(AdapterSet::try_new("MY_ADAPTERS")?)
.with_credentials(Credentials::new("alice", "hunter2"))
.with_options(ConnectionOptions::default().with_open_timeout(Duration::from_secs(5)))
.build()?;
assert_eq!(config.adapter_set().map(AdapterSet::as_str), Some("MY_ADAPTERS"));Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn builder(address: ServerAddress) -> ClientConfigBuilder
pub fn builder(address: ServerAddress) -> ClientConfigBuilder
Starts building a configuration for a server.
The address is the only value with no sensible default, so it is taken here rather than left to be forgotten.
Sourcepub const fn address(&self) -> &ServerAddress
pub const fn address(&self) -> &ServerAddress
The server this configuration points at.
Sourcepub const fn adapter_set(&self) -> Option<&AdapterSet>
pub const fn adapter_set(&self) -> Option<&AdapterSet>
The Adapter Set that will serve the session, or None to let the
server use its DEFAULT.
Sourcepub const fn credentials(&self) -> &Credentials
pub const fn credentials(&self) -> &Credentials
The credentials the session will be created with.
Sourcepub const fn options(&self) -> &ConnectionOptions
pub const fn options(&self) -> &ConnectionOptions
The timeouts, limits and reconnection policy.
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ClientConfig
impl Debug for ClientConfig
impl Eq for ClientConfig
Source§impl PartialEq for ClientConfig
impl PartialEq for ClientConfig
impl StructuralPartialEq for ClientConfig
Auto 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