Skip to content

Commit

Permalink
Implement default for BufferContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
DavJCosby committed Mar 6, 2024
1 parent d18c83f commit 41b5710
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/driver/buffers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ pub struct BufferContainer {
buffers: HashMap<CompactString, Box<dyn Buffer>>,
}

impl Default for BufferContainer {
fn default() -> Self {
Self::new()
}
}

impl BufferContainer {
pub fn new() -> Self {
BufferContainer {
Expand All @@ -18,7 +24,7 @@ impl BufferContainer {

pub fn create_buffer<T: BufferableData>(&mut self, key: &str) -> &mut Vec<T> {
self.buffers
.insert(key.to_compact_string(), Box::new(Vec::<T>::new()));
.insert(key.to_compact_string(), Box::<Vec<T>>::default());
self.get_buffer_mut(key).unwrap()
}

Expand Down

0 comments on commit 41b5710

Please sign in to comment.