Skip to main content

RestClient

Trait RestClient 

Source
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§

Source

fn get<T>( &self, endpoint: &str, ) -> impl Future<Output = Result<T, Self::Error>> + Send

Source

fn post<T, U>( &self, endpoint: &str, payload: &T, ) -> impl Future<Output = Result<U, Self::Error>> + Send

Source

fn put<T, U>( &self, endpoint: &str, payload: &T, ) -> impl Future<Output = Result<U, Self::Error>> + Send

Source

fn patch<T, U>( &self, endpoint: &str, payload: &T, ) -> impl Future<Output = Result<U, Self::Error>> + Send

Source

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".

Implementors§