Questions about Rust lifetime
问题 I'm trying to implement a memory pool based on TypedArena . Here's a simplified version of my original code: #![feature(rustc_private)] extern crate arena; use arena::TypedArena; pub struct MemoryPool { arena: TypedArena<Vec<u8>>, bytes_allocated: usize, } impl MemoryPool { pub fn consume(&mut self, buf: Vec<u8>) -> &[u8] { self.bytes_allocated += buf.capacity(); self.arena.alloc(buf) } } pub struct ByteArray<'a> { data: &'a [u8], } impl<'a> ByteArray<'a> { pub fn set_data(&mut self, data: &