Skip to main content

CustomTuning

Struct CustomTuning 

Source
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>

Source

pub fn new(branch: u16, alloc_unit: u16) -> Self
where AL: Default,

Construct with specified branch and allocation unit.

Source

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.

Source

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>

Source§

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)

Deallocates the memory referenced by ptr. Read more
Source§

fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>

Behaves like allocate, but also ensures that the returned memory is zero-initialized. Read more
Source§

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>

Behaves like grow, but also ensures that the new contents are set to zero before being returned. Read more
Source§

unsafe fn shrink( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>

Attempts to shrink the memory block. Read more
Source§

fn by_ref(&self) -> &Self
where Self: Sized,

Creates a “by reference” adapter for this instance of Allocator.
Source§

impl<AL: Clone + Allocator + Clone> Clone for CustomTuning<AL>

Source§

fn clone(&self) -> CustomTuning<AL>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<AL: Debug + Allocator + Clone> Debug for CustomTuning<AL>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<AL: Allocator + Clone + Default> Default for CustomTuning<AL>

Source§

fn default() -> Self

Construct with default allocator and default branch and allocation unit (currently 64,16).

Source§

impl<AL: Allocator + Clone> Tuning for CustomTuning<AL>

Source§

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.
Source§

fn space_action(&self, (len, alloc): (usize, usize)) -> Option<usize>

Returns the new allocation if the allocation should be reduced based on the current length and allocation.
Source§

fn set_seq(&mut self, x: bool) -> bool

Set allocation mode to be optimal for sequential (ordered) inserts.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.