[−][src]Struct xalloc::tlsf::Tlsf
TLSF-based external memory allocator.
See the module-level documentation for more.
Type parameters
T
is an integer type used to represent region sizes. You usually useu32
oru64
for this.A
is a memory arena type used to allocate internal block structures.
Implementations
impl<T: BinaryUInteger> Tlsf<T, CheckedArena<TlsfBlock<T, Ptr>>, Ptr>
[src]
impl<T: BinaryUInteger> Tlsf<T, PooledArena<TlsfBlock<T, Ptr>, SysAllocator, Ptr>, Ptr>
[src]
pub fn new(size: T) -> Self
[src]
Construct a SysTlsf
.
pub fn with_capacity(size: T, capacity: usize) -> Self
[src]
Construct a SysTlsf
with a specific capacity.
impl<T, P, A> Tlsf<T, A, P> where
T: BinaryUInteger,
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P>,
P: Clone + Default + PartialEq + Eq + Debug,
[src]
T: BinaryUInteger,
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P>,
P: Clone + Default + PartialEq + Eq + Debug,
pub fn with_arena(size: T, arena: A) -> Self
[src]
Construct a Tlsf
.
pub fn arena(&self) -> &A
[src]
Get a reference to the underlying memory arena.
pub fn arena_mut(&mut self) -> &mut A
[src]
Get a mutable reference to the underlying memory arena.
pub fn alloc_aligned(&mut self, size: T, align: T) -> Option<(TlsfRegion<P>, T)>
[src]
Allocate a region of the size size
with a given alignment requirement.
Returns a handle of the allocated region and its offset if the
allocation succeeds. Returns None
otherwise.
align
must be a power of two.size
must not be zero.
pub fn alloc(&mut self, size: T) -> Option<(TlsfRegion<P>, T)>
[src]
Allocate a region of the size size
.
Returns a handle of the allocated region and its offset if the
allocation succeeds. Returns None
otherwise.
size
must not be zero.
pub unsafe fn dealloc_unchecked(&mut self, r: TlsfRegion<P>)
[src]
Deallocate the specified region, without checking the origin of the
TlsfRegion
.
This might result in an undefined behavior if r
originates from
a different instance of Tlsf
.
impl<T, P, A> Tlsf<T, A, P> where
T: BinaryUInteger,
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P> + UnsafeArenaWithMembershipCheck<TlsfBlock<T, P>>,
P: Clone + Default + PartialEq + Eq + Debug,
[src]
T: BinaryUInteger,
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P> + UnsafeArenaWithMembershipCheck<TlsfBlock<T, P>>,
P: Clone + Default + PartialEq + Eq + Debug,
pub fn dealloc(&mut self, r: TlsfRegion<P>) -> Result<(), TlsfRegion<P>>
[src]
Deallocate the specified region.
Returns Err(r)
if r
does not originate from the same instance of Tlsf
.
impl<T, P, A> Tlsf<T, A, P> where
T: BinaryUInteger,
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P> + SafeArena<TlsfBlock<T, P>>,
P: Clone + Default + PartialEq + Eq + Debug,
[src]
T: BinaryUInteger,
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P> + SafeArena<TlsfBlock<T, P>>,
P: Clone + Default + PartialEq + Eq + Debug,
pub fn dealloc_relaxed(&mut self, r: TlsfRegion<P>)
[src]
Deallocate the specified region.
r
must originate from the same instance of Tlsf
. Otherwise, Tlsf
enters an inconsistent state and possibly panics, but does not cause an
undefined behavior.
Trait Implementations
impl<T: Debug, A: Debug, P: Debug> Debug for Tlsf<T, A, P> where
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P>,
P: Clone + Default + PartialEq + Eq + Debug,
[src]
A: UnsafeArena<TlsfBlock<T, P>, Ptr = P>,
P: Clone + Default + PartialEq + Eq + Debug,
Auto Trait Implementations
impl<T, A, P> RefUnwindSafe for Tlsf<T, A, P> where
A: RefUnwindSafe,
P: RefUnwindSafe,
T: RefUnwindSafe,
A: RefUnwindSafe,
P: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, A, P> Send for Tlsf<T, A, P> where
A: Send,
P: Send,
T: Send,
A: Send,
P: Send,
T: Send,
impl<T, A, P> Sync for Tlsf<T, A, P> where
A: Sync,
P: Sync,
T: Sync,
A: Sync,
P: Sync,
T: Sync,
impl<T, A, P> Unpin for Tlsf<T, A, P> where
A: Unpin,
P: Unpin,
T: Unpin,
A: Unpin,
P: Unpin,
T: Unpin,
impl<T, A, P> UnwindSafe for Tlsf<T, A, P> where
A: UnwindSafe,
P: UnwindSafe,
T: UnwindSafe,
A: UnwindSafe,
P: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,