Skip to content

Commit 2965939

Browse files
committed
Switch to immutable data structure.
1 parent c2adc0a commit 2965939

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

memapi/src/memorytracking.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,20 @@ pub trait FunctionLocations {
5353
/// Stores FunctionLocations, returns a FunctionId
5454
#[derive(Clone)]
5555
pub struct VecFunctionLocations {
56-
// TODO switch to immutable vec
57-
functions: Vec<FunctionLocation>,
56+
functions: ImVector<FunctionLocation>,
5857
}
5958

6059
impl VecFunctionLocations {
6160
/// Create a new tracker.
6261
pub fn new() -> Self {
6362
Self {
64-
functions: Vec::with_capacity(8192),
63+
functions: ImVector::new(),
6564
}
6665
}
6766

6867
/// Register a function, get back its id.
6968
pub fn add_function(&mut self, filename: String, function_name: String) -> FunctionId {
70-
self.functions.push(FunctionLocation {
69+
self.functions.push_back(FunctionLocation {
7170
filename,
7271
function_name,
7372
});

0 commit comments

Comments
 (0)