mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-05-31 07:30:39 +00:00
Added helper to create Vec with a given size
This commit is contained in:
@@ -30,3 +30,10 @@ pub trait HasLen {
|
||||
}
|
||||
|
||||
|
||||
pub fn create_vec_with_len<T>(capacity: usize) -> Vec<T> {
|
||||
let mut v = Vec::with_capacity(capacity);
|
||||
unsafe {
|
||||
v.set_len(capacity);
|
||||
}
|
||||
v
|
||||
}
|
||||
Reference in New Issue
Block a user