pub struct BlobTilePool {
largest_size_class: usize,
buckets: [Vec<Arc<Vec<u8>>>; 6],
}
Expand description
A pool of blob tile buffers to mitigate the overhead of allocating and deallocating blob tiles.
The pool keeps a strong reference to each allocated buffers and reuses the ones with a strong count of 1.
Fields§
§largest_size_class: usize
§buckets: [Vec<Arc<Vec<u8>>>; 6]
Implementations§
Source§impl BlobTilePool
impl BlobTilePool
pub fn new() -> Self
Sourcepub fn get_buffer(&mut self, requested_size: usize) -> MutableTileBuffer
pub fn get_buffer(&mut self, requested_size: usize) -> MutableTileBuffer
Get or allocate a tile buffer of the requested size.
The returned buffer is zero-inizitalized. The length of the returned buffer is equal to the requested size, however the buffer may be allocated with a larger capacity to conform to the pool’s corresponding bucket tile size.
fn bucket_and_size(&self, size: usize) -> (usize, usize)
Auto Trait Implementations§
impl Freeze for BlobTilePool
impl RefUnwindSafe for BlobTilePool
impl Send for BlobTilePool
impl Sync for BlobTilePool
impl Unpin for BlobTilePool
impl UnwindSafe for BlobTilePool
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