Struct ruma::client::ClientBuilder
source · pub struct ClientBuilder { /* private fields */ }
client
only.Expand description
A Client
builder.
This type can be used to construct a Client
through a few method calls.
Implementations§
source§impl ClientBuilder
impl ClientBuilder
sourcepub fn homeserver_url(self, url: String) -> ClientBuilder
pub fn homeserver_url(self, url: String) -> ClientBuilder
Set the homeserver URL.
The homeserver URL must be set before calling build()
or
http_client()
.
sourcepub fn access_token(self, access_token: Option<String>) -> ClientBuilder
pub fn access_token(self, access_token: Option<String>) -> ClientBuilder
Set the access token.
sourcepub fn supported_matrix_versions(
self,
versions: Vec<MatrixVersion>,
) -> ClientBuilder
pub fn supported_matrix_versions( self, versions: Vec<MatrixVersion>, ) -> ClientBuilder
Set the supported Matrix versions.
This method generally shouldn’t be called. The build()
or
http_client()
method will take care of doing a
get_supported_versions
request to find out about the supported versions.
sourcepub async fn build<C>(
self,
) -> Result<Client<C>, Error<<C as HttpClient>::Error, Error>>where
C: DefaultConstructibleHttpClient,
pub async fn build<C>(
self,
) -> Result<Client<C>, Error<<C as HttpClient>::Error, Error>>where
C: DefaultConstructibleHttpClient,
Finish building the Client
.
Uses DefaultConstructibleHttpClient::default()
to create an HTTP client instance.
Unless the supported Matrix versions were manually set via
supported_matrix_versions
, this will do a
get_supported_versions
request to find out about the supported versions.
sourcepub async fn http_client<C>(
self,
http_client: C,
) -> Result<Client<C>, Error<<C as HttpClient>::Error, Error>>where
C: HttpClient,
pub async fn http_client<C>(
self,
http_client: C,
) -> Result<Client<C>, Error<<C as HttpClient>::Error, Error>>where
C: HttpClient,
Set the HTTP client to finish building the Client
.
Unless the supported Matrix versions were manually set via
supported_matrix_versions
, this will do a
get_supported_versions
request to find out about the supported versions.
Auto Trait Implementations§
impl Freeze for ClientBuilder
impl RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnwindSafe for ClientBuilder
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
source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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>
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>
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