From b848b78e860de0895486a944143a548329bc4e98 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Fri, 26 Apr 2024 21:21:02 +0100 Subject: [PATCH] Add Default impl for BulkBuferBuilder --- src/buffer.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/buffer.rs b/src/buffer.rs index 441f2e3..256daab 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -15,12 +15,7 @@ pub struct BulkBufferBuilder<'a> { impl<'a> BulkBufferBuilder<'a> { pub fn new() -> Self { - Self { - order: vec![], - init_descriptors: vec![], - descriptors: vec![], - current_usage: wgpu::BufferUsages::UNIFORM, - } + Self::default() } pub fn set_usage(mut self, usage: wgpu::BufferUsages) -> Self { @@ -74,6 +69,17 @@ impl<'a> BulkBufferBuilder<'a> { } } +impl<'a> Default for BulkBufferBuilder<'a> { + fn default() -> Self { + Self { + order: vec![], + init_descriptors: vec![], + descriptors: vec![], + current_usage: wgpu::BufferUsages::UNIFORM, + } + } +} + pub trait BufferExt { fn get_mapped_range, T: bytemuck::Pod>( &self,