pub trait RestClient {
type Error;
// Required methods
fn get<T>(
&self,
endpoint: &str,
) -> impl Future<Output = Result<T, Self::Error>> + Send
where T: DeserializeOwned + Debug + Send + Sync;
fn post<T, U>(
&self,
endpoint: &str,
payload: &T,
) -> impl Future<Output = Result<U, Self::Error>> + Send
where T: ?Sized + Serialize + Debug + Send + Sync,
U: DeserializeOwned + Debug + Send + Sync;
fn put<T, U>(
&self,
endpoint: &str,
payload: &T,
) -> impl Future<Output = Result<U, Self::Error>> + Send
where T: ?Sized + Serialize + Debug + Send + Sync,
U: DeserializeOwned + Debug + Send + Sync;
fn patch<T, U>(
&self,
endpoint: &str,
payload: &T,
) -> impl Future<Output = Result<U, Self::Error>> + Send
where T: ?Sized + Serialize + Debug + Send + Sync,
U: DeserializeOwned + Debug + Send + Sync;
fn delete(
&self,
endpoint: &str,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
}Expand description
RESTful helpers returning a flat Result<T, Self::Error>.
Required Associated Types§
Required Methods§
fn get<T>( &self, endpoint: &str, ) -> impl Future<Output = Result<T, Self::Error>> + Send
fn post<T, U>( &self, endpoint: &str, payload: &T, ) -> impl Future<Output = Result<U, Self::Error>> + Send
fn put<T, U>( &self, endpoint: &str, payload: &T, ) -> impl Future<Output = Result<U, Self::Error>> + Send
fn patch<T, U>( &self, endpoint: &str, payload: &T, ) -> impl Future<Output = Result<U, Self::Error>> + Send
fn delete( &self, endpoint: &str, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".