From 41b571062ea00929720a811ea35d844371bd64be Mon Sep 17 00:00:00 2001 From: David Cosby Date: Wed, 6 Mar 2024 12:40:08 -0700 Subject: [PATCH] Implement default for BufferContainer --- src/driver/buffers.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/driver/buffers.rs b/src/driver/buffers.rs index 2285db7..08f7355 100644 --- a/src/driver/buffers.rs +++ b/src/driver/buffers.rs @@ -9,6 +9,12 @@ pub struct BufferContainer { buffers: HashMap>, } +impl Default for BufferContainer { + fn default() -> Self { + Self::new() + } +} + impl BufferContainer { pub fn new() -> Self { BufferContainer { @@ -18,7 +24,7 @@ impl BufferContainer { pub fn create_buffer(&mut self, key: &str) -> &mut Vec { self.buffers - .insert(key.to_compact_string(), Box::new(Vec::::new())); + .insert(key.to_compact_string(), Box::>::default()); self.get_buffer_mut(key).unwrap() }