pub struct ClientOptions { /* private fields */ }Expand description
Ably client options for initialising a REST or Realtime client.
Implementations§
Source§impl ClientOptions
impl ClientOptions
pub fn new(s: &str) -> Self
pub fn with_auth_url(url: Url) -> Self
pub fn with_auth_callback(callback: Arc<dyn AuthCallback>) -> Self
pub fn with_token(token: String) -> Self
Sourcepub fn client_id(self, client_id: impl Into<String>) -> Result<Self>
pub fn client_id(self, client_id: impl Into<String>) -> Result<Self>
Set the client ID, used for identifying this client when publishing messages or for presence purposes. Can be any utf-8 string except the reserved wildcard string ‘*’.
Sourcepub fn use_token_auth(self, v: bool) -> Self
pub fn use_token_auth(self, v: bool) -> Self
Indicates whether token authentication should be used even if an API key is present.
Sourcepub fn environment(self, environment: impl Into<String>) -> Result<Self>
pub fn environment(self, environment: impl Into<String>) -> Result<Self>
Sourcepub fn use_binary_protocol(self, v: bool) -> Self
pub fn use_binary_protocol(self, v: bool) -> Self
Sets the message format to MessagePack if the argument is true, or JSON if the argument is false.
Sourcepub fn default_token_params(self, params: TokenParams) -> Self
pub fn default_token_params(self, params: TokenParams) -> Self
Set the default TokenParams.
Sourcepub fn fallback_hosts(self, hosts: Vec<String>) -> Self
pub fn fallback_hosts(self, hosts: Vec<String>) -> Self
Sets the fallback hosts.
Sourcepub fn http_request_timeout(self, timeout: Duration) -> Self
pub fn http_request_timeout(self, timeout: Duration) -> Self
Sets the HTTP request timeout.
Sourcepub fn http_max_retry_count(self, count: usize) -> Self
pub fn http_max_retry_count(self, count: usize) -> Self
Sets the maximum number of HTTP retries.
Sourcepub fn rest(self) -> Result<Rest>
pub fn rest(self) -> Result<Rest>
Returns a Rest client using the ClientOptions.
§Errors
This method fails if the ClientOptions are not valid:
- the REST API URL must be valid
pub fn token_source(token: Credential) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClientOptions
impl !RefUnwindSafe for ClientOptions
impl Send for ClientOptions
impl Sync for ClientOptions
impl Unpin for ClientOptions
impl !UnwindSafe for ClientOptions
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