mirror of
https://git.proxmox.com/git/pathpatterns
synced 2025-07-13 12:55:34 +00:00
MatchList::with_capacity and Into<Vec<MatchEntry>>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
d5c0e44a9d
commit
96d7b7c74d
@ -214,10 +214,19 @@ impl MatchList {
|
||||
Self { list: list.into() }
|
||||
}
|
||||
|
||||
/// Create a new empty list with a specified maximum capacity.
|
||||
pub fn with_capacity(capacity: usize) -> Self {
|
||||
Self {
|
||||
list: Vec::with_capacity(capacity)
|
||||
}
|
||||
}
|
||||
|
||||
/// Add another entry.
|
||||
pub fn push(&mut self, entry: MatchEntry) {
|
||||
self.list.push(entry)
|
||||
}
|
||||
|
||||
/// Remove the list entry.
|
||||
pub fn pop(&mut self) -> Option<MatchEntry> {
|
||||
self.list.pop()
|
||||
}
|
||||
@ -229,6 +238,12 @@ impl From<Vec<MatchEntry>> for MatchList {
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<Vec<MatchEntry>> for MatchList {
|
||||
fn into(self) -> Vec<MatchEntry> {
|
||||
self.list
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Deref for MatchList {
|
||||
type Target = MatchListRef;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user