pub struct CustomTuning<AL: Allocator + Clone = Global> { /* private fields */ }Expand description
Implementation of Tuning. Default branch is 64, default allocation unit is 16.
Implementations§
Source§impl<AL: Allocator + Clone> CustomTuning<AL>
impl<AL: Allocator + Clone> CustomTuning<AL>
Sourcepub fn new(branch: u16, alloc_unit: u16) -> Selfwhere
AL: Default,
pub fn new(branch: u16, alloc_unit: u16) -> Selfwhere
AL: Default,
Construct with specified branch and allocation unit.
Sourcepub const fn new_in(branch: u16, alloc_unit: u16, alloc: AL) -> Self
pub const fn new_in(branch: u16, alloc_unit: u16, alloc: AL) -> Self
Construct with specified branch, allocation unit and allocator.
The minimum branch is 6. A small branch is faster for insertion but slower for retrieval.
A small alloc_unit is slower for insertion but uses less memory.
Sourcepub const fn new_in_def(alloc: AL) -> Self
pub const fn new_in_def(alloc: AL) -> Self
Construct with specified allocator and default branch and allocation unit (currently 64,16).
Trait Implementations§
Source§impl<AL: Allocator + Clone> Allocator for CustomTuning<AL>
impl<AL: Allocator + Clone> Allocator for CustomTuning<AL>
Source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
Attempts to allocate a block of memory.
Source§unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
Deallocates the memory referenced by
ptr. Read moreSource§fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
Behaves like
allocate, but also ensures that the returned memory is zero-initialized. Read moreSource§unsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>
Attempts to extend the memory block. Read more
Source§unsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow_zeroed( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>
Behaves like
grow, but also ensures that the new contents are set to zero before being
returned. Read moreSource§impl<AL: Clone + Allocator + Clone> Clone for CustomTuning<AL>
impl<AL: Clone + Allocator + Clone> Clone for CustomTuning<AL>
Source§fn clone(&self) -> CustomTuning<AL>
fn clone(&self) -> CustomTuning<AL>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<AL: Allocator + Clone> Tuning for CustomTuning<AL>
impl<AL: Allocator + Clone> Tuning for CustomTuning<AL>
Source§fn full_action(&self, i: usize, len: usize) -> FullAction
fn full_action(&self, i: usize, len: usize) -> FullAction
Determine what to do when the size of an underlying BTree vector needs to be increased.
Auto Trait Implementations§
impl<AL> Freeze for CustomTuning<AL>where
AL: Freeze,
impl<AL> RefUnwindSafe for CustomTuning<AL>where
AL: RefUnwindSafe,
impl<AL> Send for CustomTuning<AL>where
AL: Send,
impl<AL> Sync for CustomTuning<AL>where
AL: Sync,
impl<AL> Unpin for CustomTuning<AL>where
AL: Unpin,
impl<AL> UnwindSafe for CustomTuning<AL>where
AL: 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