[][src]Struct matrix_sdk::ClientConfig

pub struct ClientConfig { /* fields omitted */ }

Configuration for the creation of the Client.

When setting the StateStore it is up to the user to open/connect the storage backend before client creation.

Example

// To pass all the request through mitmproxy set the proxy and disable SSL
// verification
let client_config = ClientConfig::new()
    .proxy("http://localhost:8080")
    .unwrap()
    .disable_ssl_verification();

An example of adding a default JsonStore to the Client.


let store = JsonStore::open("path/to/json").unwrap();
let client_config = ClientConfig::new()
    .state_store(Box::new(store));

Implementations

impl ClientConfig[src]

pub fn new() -> Self[src]

Create a new default ClientConfig.

pub fn proxy(self, proxy: &str) -> Result<Self>[src]

Set the proxy through which all the HTTP requests should go.

Note, only HTTP proxies are supported.

Arguments

  • proxy - The HTTP URL of the proxy.

Example

use matrix_sdk::ClientConfig;

let client_config = ClientConfig::new()
    .proxy("http://localhost:8080")
    .unwrap();

pub fn disable_ssl_verification(self) -> Self[src]

Disable SSL verification for the HTTP requests.

pub fn user_agent(self, user_agent: &str) -> StdResult<Self, InvalidHeaderValue>[src]

Set a custom HTTP user agent for the client.

pub fn state_store(self, store: Box<dyn StateStore>) -> Self[src]

Set a custom implementation of a StateStore.

The state store should be opened before being set.

pub fn store_path(self, path: impl AsRef<Path>) -> Self[src]

Set the path for storage.

Arguments

  • path - The path where the stores should save data in. It is the callers responsibility to make sure that the path exists.

In the default configuration the client will open default implementations for the crypto store and the state store. It will use the given path to open the stores. If no path is provided no store will be opened

pub fn passphrase(self, passphrase: String) -> Self[src]

Set the passphrase to encrypt the crypto store.

Argument

  • passphrase - The passphrase that will be used to encrypt the data in the cryptostore.

This is only used if no custom cryptostore is set.

pub fn timeout(self, timeout: Duration) -> Self[src]

Set a timeout duration for all HTTP requests. The default is no timeout.

pub fn client(self, client: Arc<dyn HttpSend>) -> Self[src]

Specify a client to handle sending requests and receiving responses.

Any type that implements the HttpSend trait can be used to send/receive http types.

Trait Implementations

impl Debug for ClientConfig[src]

impl Default for ClientConfig[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AsyncTraitDeps for T where
    T: Send + Sync + Debug
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]