I am using hyper and I am confuse with some codes.
My code is like
self.hyper_client = ...
match Request::builder()
.method(Method::POST)
.uri(uri)
.header("content-type", "application/json")
.body(Body::from(serde_json::to_string(&content).unwrap()))
{
Ok(req) => {
match self.hyper_client.request(req).await
},
Err(err) => {
...
}
}
First I think the req object generated by Request::builder is not static lifetime right?
But in client.request function, the prototype is pub fn request(&self, mut req: Request<B>) -> ResponseFuture and Client's B is
impl<C, B> Client<C, B>
where
C: Connect + Clone + Send + Sync + 'static,
B: HttpBody + Send + 'static,
B::Data: Send,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
{
....
it seems B should be static?
I am confused about static lifetime, can you help me about it?
Thanks.