pub struct TESGlobalAlloc;
Expand description
The Skyrim global memory allocator using MemoryManager
C++ class.
It implements Allocator
and GlobalAlloc
, so it can be used for #[global_allocator]
and other Allocator changeable arrays.
Note: while this type is unstable, the functionality it provides can be
accessed through the free functions in alloc
.
§CI
Skyrim MemoryManager
is not available for CI,
Therefore, the test_on_ci
feature is enabled, it will automatically fall back to Rust’s Global
.
Trait Implementations§
Source§impl Allocator for TESGlobalAlloc
impl Allocator for TESGlobalAlloc
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. Read more
Source§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 deallocate(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
Deallocates the memory referenced by
ptr
. 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 Clone for TESGlobalAlloc
impl Clone for TESGlobalAlloc
Source§fn clone(&self) -> TESGlobalAlloc
fn clone(&self) -> TESGlobalAlloc
Returns a copy 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 Debug for TESGlobalAlloc
impl Debug for TESGlobalAlloc
Source§impl Default for TESGlobalAlloc
impl Default for TESGlobalAlloc
Source§fn default() -> TESGlobalAlloc
fn default() -> TESGlobalAlloc
Returns the “default value” for a type. Read more
Source§impl GlobalAlloc for TESGlobalAlloc
impl GlobalAlloc for TESGlobalAlloc
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 moreSource§impl PartialEq for TESGlobalAlloc
impl PartialEq for TESGlobalAlloc
Source§impl SelflessAllocator for TESGlobalAlloc
impl SelflessAllocator for TESGlobalAlloc
Source§fn allocate(layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(layout: Layout) -> Result<NonNull<[u8]>, AllocError>
Allocates a block of memory described by the given layout. Read more
Source§fn allocate_zeroed(layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(layout: Layout) -> Result<NonNull<[u8]>, AllocError>
Allocates zero-initialized memory. Read more
Source§unsafe fn deallocate(ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(ptr: NonNull<u8>, layout: Layout)
Deallocates a previously allocated block of memory. Read more
Source§unsafe fn grow(
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow( ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>
Grows a memory block to a new layout. Read more
impl StructuralPartialEq for TESGlobalAlloc
Auto Trait Implementations§
impl Freeze for TESGlobalAlloc
impl RefUnwindSafe for TESGlobalAlloc
impl Send for TESGlobalAlloc
impl Sync for TESGlobalAlloc
impl Unpin for TESGlobalAlloc
impl UnwindSafe for TESGlobalAlloc
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