1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
use crate::body::Body; use crate::request::RequestExt; use crate::Error; use http::{Request, Response}; #[derive(Clone, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Backend(String); impl Backend { pub fn from_str(s: &str) -> Self { Self(s.into()) } pub fn send(&self, req: Request<Body>, ttl: i32) -> Result<Response<Body>, Error> { req.send(self.0.as_str(), ttl) } }