Trait implementation does not let specify lifetime in function

My issue is with improper lifetimes, but I'll have to share the background a bit. I am new to Rust and some of this might be absolute non-sense, please correct me if I am wrong anywhere.

I am trying to write a HTTP Server with hyper using a reusable buffer for containing request body. There are two structs involved and both implement the hyper::service::Service trait. The service that handles the request is implemented on struct A and the service that generates A (Make service) every time a new request arrives, is implemented on struct B.

I have designed the entire thing with B owning the pool and A holding a mutable reference to a Vec<u8> generated from the pool and then drop it the request completes. This is how my code looks:

struct A<'a, S: Sized> {
    initializer: fn(&Context) -> Result<S, Error>,
    buffer: &'a mut Vec<u8>

pub struct B<S: Sized> {
    initializer: fn(&RuntimeContext) -> Result<S, Error>,
    pool: Pool<Vec<u8>>,
    capacity: usize

impl<T, S: Sized> Service<T> for B<S> {
    type Response = A<'static, S>;
    type Error = Error;
    type Future = future::Ready<Result<Self::Response, Self::Error>>;

    fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
        if self.pool.len() == self.capacity {
        } else {

    fn call(&mut self, _: T) -> Self::Future {
        let mut reusable_buffer = self.pool.try_pull().unwrap();
        future::ok(A::new(self.initializer, reusable_buffer.as_mut()))

I am getting an issue with lifetimes while doing this:

error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
   --> src/
440 |     fn call(&mut self, _: T) -> Self::Future {
    |             --------- this data with an anonymous lifetime `'_`...
441 |         let mut reusable_buffer = self.pool.try_pull().unwrap();
    |                                   --------- ^^^^^^^^
    |                                   |
    |                          captured here...
442 |         reusable_buffer.clear();
443 |         future::ok(A::new(self.initializer, reusable_buffer.as_mut()))
    |         --------------------------------------------------------------------- ...and is required to live as long as `'static` here

Here are the fixes I have tried these things:

  • In the call(), changes &mut self to &'static mut self, but I get lifetime mismatch error:
error[E0308]: method not compatible with trait
   --> src/
436 |     fn call(&'static mut self, _: T) -> Self::Future {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
    = note: expected fn pointer `fn(&mut B<S>, _) -> futures::future::Ready<_>`
               found fn pointer `fn(&'static mut B<S>, _) -> futures::future::Ready<_>`
  • Added a generic lifetime to B along with a PhantomData, passed that lifetime to impl block of Service, but that did not work as well: I got "lifetime mismatch" error.

As per my understanding, I am telling compiler these things:

  • In struct A, there is a mutable reference to Vec<u8> which is valid as long as A is lives.
  • In struct B, the output of function call() contains another struct which holds a mutable reference to Vec<u8> having static lifetime.

These are the things I want to tell compiler:

  • B will live with a static lifetime.
  • Since B has a static lifetime, inherently its pool will have static lifetime. Hence any mutable references that pool yields should also have a static lifetime.

Can I get some help in fixing these issues and to know if I am asking right things?