Struct HttpClient
pub struct HttpClient { /* private fields */ }Expand description
Calls an engine or server through its HTTP API.
Implementations§
§impl HttpClient
impl HttpClient
pub fn new(url: &str, token: Option<String>) -> Result<Self>
pub fn new(url: &str, token: Option<String>) -> Result<Self>
url: http://host:port (a path after it is ignored).
pub fn url(&self) -> String
pub async fn request(
&self,
method: &str,
path: &str,
body: Option<&Value>,
) -> Result<(u16, Vec<u8>)>
pub async fn request( &self, method: &str, path: &str, body: Option<&Value>, ) -> Result<(u16, Vec<u8>)>
One request; the body is JSON. Returns the status and the body.
pub async fn call_method(&self, method: &str, args: Value) -> Result<Value>
pub async fn call_method(&self, method: &str, args: Value) -> Result<Value>
A call by protocol method name.
Trait Implementations§
§impl Calls for HttpClient
impl Calls for HttpClient
fn call<'a>(&'a self, method: &'a str, args: Value) -> CallFuture<'a>
§impl Clone for HttpClient
impl Clone for HttpClient
§fn clone(&self) -> HttpClient
fn clone(&self) -> HttpClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HttpClient
impl RefUnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl UnsafeUnpin 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