@@ -113,7 +113,7 @@ impl<T: Clone> Dict<T> {
113
113
}
114
114
115
115
fn unchecked_push (
116
- & mut self ,
116
+ & self ,
117
117
hash_index : HashIndex ,
118
118
hash_value : HashValue ,
119
119
key : PyObjectRef ,
@@ -133,7 +133,7 @@ impl<T: Clone> Dict<T> {
133
133
134
134
/// Store a key
135
135
pub fn insert < K : DictKey + IntoPyObject + Copy > (
136
- & mut self ,
136
+ & self ,
137
137
vm : & VirtualMachine ,
138
138
key : K ,
139
139
value : T ,
@@ -193,23 +193,23 @@ impl<T: Clone> Dict<T> {
193
193
}
194
194
}
195
195
196
- pub fn clear ( & mut self ) {
196
+ pub fn clear ( & self ) {
197
197
let mut inner = self . borrow_value_mut ( ) ;
198
198
inner. entries . clear ( ) ;
199
199
inner. indices . clear ( ) ;
200
200
inner. size = 0
201
201
}
202
202
203
203
/// Delete a key
204
- pub fn delete ( & mut self , vm : & VirtualMachine , key : & PyObjectRef ) -> PyResult < ( ) > {
204
+ pub fn delete ( & self , vm : & VirtualMachine , key : & PyObjectRef ) -> PyResult < ( ) > {
205
205
if self . delete_if_exists ( vm, key) ? {
206
206
Ok ( ( ) )
207
207
} else {
208
208
Err ( vm. new_key_error ( key. clone ( ) ) )
209
209
}
210
210
}
211
211
212
- pub fn delete_if_exists ( & mut self , vm : & VirtualMachine , key : & PyObjectRef ) -> PyResult < bool > {
212
+ pub fn delete_if_exists ( & self , vm : & VirtualMachine , key : & PyObjectRef ) -> PyResult < bool > {
213
213
loop {
214
214
if let LookupResult :: Existing ( entry_index) = self . lookup ( vm, key) ? {
215
215
let mut inner = self . borrow_value_mut ( ) ;
@@ -228,7 +228,7 @@ impl<T: Clone> Dict<T> {
228
228
}
229
229
230
230
pub fn delete_or_insert (
231
- & mut self ,
231
+ & self ,
232
232
vm : & VirtualMachine ,
233
233
key : & PyObjectRef ,
234
234
value : T ,
@@ -361,7 +361,7 @@ impl<T: Clone> Dict<T> {
361
361
}
362
362
363
363
/// Retrieve and delete a key
364
- pub fn pop < K : DictKey + Copy > ( & mut self , vm : & VirtualMachine , key : K ) -> PyResult < Option < T > > {
364
+ pub fn pop < K : DictKey + Copy > ( & self , vm : & VirtualMachine , key : K ) -> PyResult < Option < T > > {
365
365
loop {
366
366
if let LookupResult :: Existing ( index) = self . lookup ( vm, key) ? {
367
367
let mut inner = self . borrow_value_mut ( ) ;
@@ -380,7 +380,7 @@ impl<T: Clone> Dict<T> {
380
380
}
381
381
}
382
382
383
- pub fn pop_front ( & mut self ) -> Option < ( PyObjectRef , T ) > {
383
+ pub fn pop_front ( & self ) -> Option < ( PyObjectRef , T ) > {
384
384
let mut position = 0 ;
385
385
let mut inner = self . borrow_value_mut ( ) ;
386
386
let first_item = inner. entries . iter ( ) . find_map ( |entry| {
0 commit comments