pub struct HttpClient { /* private fields */ }
Expand description
A JSON-HTTP client that sends the request via HTTP POST to an URL.
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn new(client: Client, url: Url, basic_auth: Option<Credentials>) -> Self
pub fn new(client: Client, url: Url, basic_auth: Option<Credentials>) -> Self
Creates a new HTTP client.
§Arguments
client
: Thereqwest::Client
to use for the HTTP requests.url
: The URL to which the requests are send.basic_auth
: Credentials used for HTTP Basic Authentication (optional).
Trait Implementations§
Source§impl Client for HttpClient
impl Client for HttpClient
Source§fn send_request<'life0, 'life1, 'life2, 'async_trait, P, R>(
&'life0 self,
method: &'life1 str,
params: &'life2 P,
) -> Pin<Box<dyn Future<Output = Result<R, Error>> + Send + 'async_trait>>
fn send_request<'life0, 'life1, 'life2, 'async_trait, P, R>( &'life0 self, method: &'life1 str, params: &'life2 P, ) -> Pin<Box<dyn Future<Output = Result<R, Error>> + Send + 'async_trait>>
Sends a JSON-HTTP request Read more
Source§fn connect_stream<'life0, 'async_trait, T>(
&'life0 self,
_id: SubscriptionId,
) -> Pin<Box<dyn Future<Output = BoxStream<'static, T>> + Send + 'async_trait>>where
T: 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn connect_stream<'life0, 'async_trait, T>(
&'life0 self,
_id: SubscriptionId,
) -> Pin<Box<dyn Future<Output = BoxStream<'static, T>> + Send + 'async_trait>>where
T: 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
If the client supports streams (i.e. receiving notifications), this should return a stream for the specific
subscription ID. Read more
Source§fn disconnect_stream<'life0, 'async_trait>(
&'life0 self,
_id: SubscriptionId,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect_stream<'life0, 'async_trait>(
&'life0 self,
_id: SubscriptionId,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
If the client supports streams (i.e. receiving notifications) and there is a matching subscription ID, this
should close the corresponding stream. Read more
Auto Trait Implementations§
impl !Freeze for HttpClient
impl !RefUnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl !UnwindSafe for HttpClient
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