Struct ruma_client::ClientBuilder
source · [−]pub struct ClientBuilder { /* private fields */ }
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
Available on crate feature client-api
only.
pub fn homeserver_url(self, url: String) -> Self
client-api
only.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
Available on crate feature client-api
only.
pub fn access_token(self, access_token: Option<String>) -> Self
client-api
only.Set the access token.
sourcepub fn supported_matrix_versions(self, versions: Vec<MatrixVersion>) -> Self
Available on crate feature client-api
only.
pub fn supported_matrix_versions(self, versions: Vec<MatrixVersion>) -> Self
client-api
only.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,
Available on crate feature client-api
only.
pub async fn build<C>(self) -> Result<Client<C>, Error<C::Error, Error>> where
C: DefaultConstructibleHttpClient,
client-api
only.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,
Available on crate feature client-api
only.
pub async fn http_client<C>(
self,
http_client: C
) -> Result<Client<C>, Error<C::Error, Error>> where
C: HttpClient,
client-api
only.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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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