mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-26 02:54:15 +00:00
implement Default
trait
This commit is contained in:
parent
9e86e9b29f
commit
9072b4dd21
@ -9,6 +9,12 @@ pub struct Memory {
|
||||
index: RefCell<HashMap<String, i64>>,
|
||||
}
|
||||
|
||||
impl Default for Memory {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Memory {
|
||||
// Constructors
|
||||
|
||||
@ -56,7 +62,7 @@ impl Memory {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get recent requests vector sorted DESC by `ID`
|
||||
/// Get recent requests vector sorted by `ID` DESC
|
||||
pub fn recent(&self, limit: usize) -> Vec<String> {
|
||||
let mut recent: Vec<String> = Vec::new();
|
||||
for (request, _) in self
|
||||
@ -71,7 +77,7 @@ impl Memory {
|
||||
recent
|
||||
}
|
||||
|
||||
/// Get total records in memory pool
|
||||
/// Get records total
|
||||
pub fn total(&self) -> usize {
|
||||
self.index.borrow().len()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user