1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
pub use http;
pub use http::{Request, Response};
pub type Body = Vec<u8>;
use std::io;
pub trait Endpoint {
type ParseResponseOutput;
type RetryReason;
fn render_request(&self) -> io::Result<Request<Body>>;
fn parse_response(
&mut self,
response: Response<Body>,
) -> io::Result<EndpointParseResponseOutput<Self::ParseResponseOutput, Self::RetryReason>>;
}
pub enum EndpointParseResponseOutput<ParseResponseOutput, RetryReason> {
Retryable(RetryReason),
Done(ParseResponseOutput),
}