Trait Endpoint

Source
pub trait Endpoint {
    // Required methods
    fn method(&self) -> Method;
    fn endpoint(&self) -> Cow<'static, str>;

    // Provided methods
    fn parameters(&self) -> QueryParams { ... }
    fn body(&self) -> Result<Vec<u8>, BodyError> { ... }
}
Expand description

Http endpoint trait for cargo-api.

§Credits

Inspired by Ben Boeckel’s blog post titled “Designing Rust bindings for REST APIs”.

Required Methods§

Source

fn method(&self) -> Method

Source

fn endpoint(&self) -> Cow<'static, str>

Provided Methods§

Implementations on Foreign Types§

Source§

impl<E> Endpoint for &E
where E: Endpoint,

Source§

fn method(&self) -> Method

Source§

fn endpoint(&self) -> Cow<'static, str>

Source§

fn parameters(&self) -> QueryParams

Source§

fn body(&self) -> Result<Vec<u8>, BodyError>

Implementors§

Source§

impl<'a> Endpoint for Crate<'a>