mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
pddb: make select_basis and latest_basis non-mut
These do not need to clone data and do not need to be mut. This improves access time considerably. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
c1e585c37c
commit
6ae91d8e46
1 changed files with 4 additions and 4 deletions
|
|
@ -268,7 +268,7 @@ impl BasisCache {
|
|||
}
|
||||
al
|
||||
}
|
||||
fn select_basis(&mut self, basis_name: Option<&str>) -> Option<usize> {
|
||||
fn select_basis(&self, basis_name: Option<&str>) -> Option<usize> {
|
||||
if self.cache.len() == 0 {
|
||||
log::error!("Can't select basis: PDDB is not mounted");
|
||||
return None
|
||||
|
|
@ -895,10 +895,10 @@ impl BasisCache {
|
|||
}
|
||||
ret
|
||||
}
|
||||
pub(crate) fn basis_latest(&mut self) -> Option<String> {
|
||||
pub(crate) fn basis_latest(&self) -> Option<&str> {
|
||||
if let Some(basis_index) = self.select_basis(None) {
|
||||
let basis = &mut self.cache[basis_index];
|
||||
Some(basis.name.clone())
|
||||
let basis = &self.cache[basis_index];
|
||||
Some(&basis.name)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue