pub struct BufferPoolBuilder<V: Default + Clone> { /* private fields */ }Expand description
A builder interface for creating a new BufferPool.
Implementations§
Source§impl<V: Default + Clone> BufferPoolBuilder<V>
impl<V: Default + Clone> BufferPoolBuilder<V>
Sourcepub fn new() -> BufferPoolBuilder<V>
pub fn new() -> BufferPoolBuilder<V>
Examples found in repository?
examples/sum-vector.rs (line 4)
3fn main() {
4 let mut pool: BufferPool<usize> = BufferPoolBuilder::new()
5 .with_buffer_size(1024)
6 .with_capacity(100)
7 .build();
8 let mut buffer = pool.get_cleared_space().unwrap();
9 for (index, value) in buffer.as_mut().iter_mut().enumerate() {
10 *value = index;
11 }
12 let sum: usize = buffer.as_ref().iter().sum();
13 println!("Sum {}", sum);
14}Sourcepub fn with_capacity(self, capacity: usize) -> BufferPoolBuilder<V>
pub fn with_capacity(self, capacity: usize) -> BufferPoolBuilder<V>
Set the capacity of the buffer pool - the max number of internal buffers.
Examples found in repository?
examples/sum-vector.rs (line 6)
3fn main() {
4 let mut pool: BufferPool<usize> = BufferPoolBuilder::new()
5 .with_buffer_size(1024)
6 .with_capacity(100)
7 .build();
8 let mut buffer = pool.get_cleared_space().unwrap();
9 for (index, value) in buffer.as_mut().iter_mut().enumerate() {
10 *value = index;
11 }
12 let sum: usize = buffer.as_ref().iter().sum();
13 println!("Sum {}", sum);
14}Sourcepub fn with_buffer_size(self, buffer_size: usize) -> BufferPoolBuilder<V>
pub fn with_buffer_size(self, buffer_size: usize) -> BufferPoolBuilder<V>
Set the buffer size / length of the internal buffers.
Examples found in repository?
examples/sum-vector.rs (line 5)
3fn main() {
4 let mut pool: BufferPool<usize> = BufferPoolBuilder::new()
5 .with_buffer_size(1024)
6 .with_capacity(100)
7 .build();
8 let mut buffer = pool.get_cleared_space().unwrap();
9 for (index, value) in buffer.as_mut().iter_mut().enumerate() {
10 *value = index;
11 }
12 let sum: usize = buffer.as_ref().iter().sum();
13 println!("Sum {}", sum);
14}Sourcepub fn build(self) -> BufferPool<V>
pub fn build(self) -> BufferPool<V>
Examples found in repository?
examples/sum-vector.rs (line 7)
3fn main() {
4 let mut pool: BufferPool<usize> = BufferPoolBuilder::new()
5 .with_buffer_size(1024)
6 .with_capacity(100)
7 .build();
8 let mut buffer = pool.get_cleared_space().unwrap();
9 for (index, value) in buffer.as_mut().iter_mut().enumerate() {
10 *value = index;
11 }
12 let sum: usize = buffer.as_ref().iter().sum();
13 println!("Sum {}", sum);
14}Trait Implementations§
Auto Trait Implementations§
impl<V> Freeze for BufferPoolBuilder<V>
impl<V> RefUnwindSafe for BufferPoolBuilder<V>where
V: RefUnwindSafe,
impl<V> Send for BufferPoolBuilder<V>where
V: Send,
impl<V> Sync for BufferPoolBuilder<V>where
V: Sync,
impl<V> Unpin for BufferPoolBuilder<V>where
V: Unpin,
impl<V> UnsafeUnpin for BufferPoolBuilder<V>
impl<V> UnwindSafe for BufferPoolBuilder<V>where
V: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more