Skip to content

qrlpx/tmp_vec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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();
         ...
    }
}
        

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages