pub struct MemPool<A: Allocator = PoolAlloc>(/* private fields */);
Expand description
单线程分配资源,不支持Sync, 但只是Send. 因为已分配资源析构的时候并不会访问Pool 所有内存都在Pool析构的时候集中释放,不存在多线程访问的情况
Implementations§
Trait Implementations§
Source§impl<A: Allocator> GlobalAlloc for Pool<A>
impl<A: Allocator> GlobalAlloc for Pool<A>
Source§unsafe fn alloc(&self, layout: Layout) -> *mut u8
unsafe fn alloc(&self, layout: Layout) -> *mut u8
Allocates memory as described by the given
layout
. Read moreimpl<A: Allocator> Pool for Pool<A>
impl<A: Allocator + Send> Send for Pool<A>
Auto Trait Implementations§
impl<A = PoolAlloc> !Freeze for Pool<A>
impl<A = PoolAlloc> !RefUnwindSafe for Pool<A>
impl<A = PoolAlloc> !Sync for Pool<A>
impl<A> Unpin for Pool<A>where
A: Unpin,
impl<A> UnwindSafe for Pool<A>where
A: 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
Source§impl<A> GenericAlloc for A
impl<A> GenericAlloc for A
Source§unsafe fn init_slice<T>(
&self,
len: usize,
val: T,
) -> Result<NonNull<[T]>, Error>where
T: Clone,
unsafe fn init_slice<T>(
&self,
len: usize,
val: T,
) -> Result<NonNull<[T]>, Error>where
T: Clone,
Safety Read more
Source§unsafe fn alloc_slice_then<T, F>(
&self,
len: usize,
f: F,
) -> Result<NonNull<[T]>, Error>
unsafe fn alloc_slice_then<T, F>( &self, len: usize, f: F, ) -> Result<NonNull<[T]>, Error>
Safety Read more
Source§unsafe fn zeroed_slice<T>(
&self,
len: usize,
) -> Result<NonNull<[MaybeUninit<T>]>, Error>
unsafe fn zeroed_slice<T>( &self, len: usize, ) -> Result<NonNull<[MaybeUninit<T>]>, Error>
Safety Read more
Source§unsafe fn uninit_slice<T>(
&self,
len: usize,
) -> Result<NonNull<[MaybeUninit<T>]>, Error>
unsafe fn uninit_slice<T>( &self, len: usize, ) -> Result<NonNull<[MaybeUninit<T>]>, Error>
Safety Read more