mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-18 03:56:42 +00:00
Fix multiple Default
implementation caveats
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
8633893bb9
commit
d6714c4b47
@ -5,6 +5,7 @@ use alloc::vec::Vec;
|
||||
/// SlotVec is the variant of Vector.
|
||||
/// It guarantees that the index of one item remains unchanged during adding
|
||||
/// or deleting other items of the vector.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SlotVec<T> {
|
||||
// The slots to store items.
|
||||
slots: Vec<Option<T>>,
|
||||
@ -118,11 +119,8 @@ impl<T> SlotVec<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Clone> Clone for SlotVec<T> {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
slots: self.slots.clone(),
|
||||
num_occupied: self.num_occupied,
|
||||
}
|
||||
impl Default for SlotVec<()> {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user