wetstring/src/request_response.rs

20 lines
427 B
Rust

pub trait Request {
type Response;
fn from_string(request_string: &str) -> RequestParseResult<Self, Self::Response>
where
Self: Sized,
Self::Response: Response;
}
pub trait Response {
fn to_string(self) -> String;
}
pub type ProcessRequest<Req, Res> = fn(request: &Req) -> Res;
pub enum RequestParseResult<Req: Request, Res: Response> {
Incomplete,
Complete(Req),
Invalid(Res),
}