boxcar
boxcar copied to clipboard
feature request push_get()
so i am making an arena allocator for something and boxcar has been a life saver. runing
pub fn alloc(&self,s:String)->&str{
self.vec.get(self.0.push(s)).unwrap()
}
does wonders its like SO simple and it works great. problem is it makes for a bad binary even on release. the fact we have to call get again after the push is costing a lot.
if we had a push_get method which would return not only the id but also a reference that would be amazing.
I agree this should be possible. Perhaps it makes sense to change the signature of push_with to return &T (or maybe (usize, &T)), as the index is already available from within the closure, instead of adding a new method.