Struct ruma_client::ClientBuilder
source · [−]pub struct ClientBuilder { /* private fields */ }
client-api
only.Expand description
A Client
builder.
This type can be used to construct a Client
through a few method calls.
Implementations
sourceimpl ClientBuilder
impl ClientBuilder
sourcepub fn homeserver_url(self, url: String) -> Self
pub fn homeserver_url(self, url: String) -> Self
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>) -> Self
pub fn access_token(self, access_token: Option<String>) -> Self
Set the access token.
sourcepub fn supported_matrix_versions(self, versions: Vec<MatrixVersion>) -> Self
pub fn supported_matrix_versions(self, versions: Vec<MatrixVersion>) -> Self
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::Error, Error>>where
C: DefaultConstructibleHttpClient,
pub async fn build<C>(self) -> Result<Client<C>, Error<C::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::Error, Error>>where
C: HttpClient,
pub async fn http_client<C>(
self,
http_client: C
) -> Result<Client<C>, Error<C::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 RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnwindSafe for ClientBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more