These are chat archives for rust-lang/rust
Vec<Box<dyn Trait>>has two indirections and many small allocations. I'm interested only in iterating, no index based access.
let thing = env::var("THING") .and_then(|s| s.parse::<u16>()) .unwrap_or(5000u16);
.map_err, but I would take advantage of the
?operator's ability to use
s.parsefails, you want to default to 5000?
let thing = env::var("THING").ok() .and_then(|s| s.parse::<u16>().ok()) .unwrap_or(5000u16);
push<T: Trait>(&mut self, value: T)))
So it would be great if they will fill cache together rather than be scattered
You're trying to beat the allocator here in managing to allocate items efficiently; really, better don't until it becomes a problem.
SmallVec<[Box<dyn Trait>; ? ]>which seems safer than trying to store unsied values contiguously