Documentation
  • Coverage
  • 16.67%
    1 out of 6 items documented1 out of 6 items with examples
  • Size
  • Source code size: 9.23 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.88 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • qrlpx/tmp_vec
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • fkoep

Problem:

pub struct Foo {
    ...
}

impl Foo {
    fn do_something(&mut self, ...){
        //FIXME: avoid allocation. can't fix this because T is lifetime-bound.
        let mut guards: Vec<Guard<'x>> = Vec::with_capacity(xxx.len());
        ...
    }
}

Solution:

use tmp_vec::TmpVec;

pub struct Foo {
    tmp_guards: TmpVec<Guard<'static>>,
    ...
}

impl Foo {
    fn do_something(&mut self, ...){
         let mut guards = self.tmp_guards.borrow_mut();
         ...
    }
}