[−][src]Trait alloc_wg::alloc::ReallocRef
Provided methods
unsafe fn realloc(
&mut self,
ptr: NonNull<u8>,
old_layout: NonZeroLayout,
new_layout: NonZeroLayout
) -> Result<NonNull<u8>, Self::Error>
&mut self,
ptr: NonNull<u8>,
old_layout: NonZeroLayout,
new_layout: NonZeroLayout
) -> Result<NonNull<u8>, Self::Error>
Safety
ptr
must be currently allocated via this allocator,layout
must fit theptr
(see above). (Thenew_size
argument need not fit it.)new_size
, when rounded up to the nearest multiple oflayout.align()
, must not overflow (i.e., the rounded value must be less thanusize::MAX
).
(Extension subtraits might provide more specific bounds on behavior, e.g., guarantee a sentinel address or a null pointer in response to a zero-size allocation request.)
Errors
Returns Err
only if the new layout
does not meet the allocator's size
and alignment constraints of the allocator, or if reallocation
otherwise fails.
Implementations are encouraged to return Err
on memory
exhaustion rather than panicking or aborting, but this is not
a strict requirement. (Specifically: it is legal to
implement this trait atop an underlying native allocation
library that aborts on memory exhaustion.)
Implementations on Foreign Types
impl ReallocRef for System
[src]
unsafe fn realloc(
&mut self,
ptr: NonNull<u8>,
old_layout: NonZeroLayout,
new_layout: NonZeroLayout
) -> Result<NonNull<u8>, Self::Error>
[src]
&mut self,
ptr: NonNull<u8>,
old_layout: NonZeroLayout,
new_layout: NonZeroLayout
) -> Result<NonNull<u8>, Self::Error>
Implementors
impl ReallocRef for Global
[src]
unsafe fn realloc(
&mut self,
ptr: NonNull<u8>,
old_layout: NonZeroLayout,
new_layout: NonZeroLayout
) -> Result<NonNull<u8>, Self::Error>
[src]
&mut self,
ptr: NonNull<u8>,
old_layout: NonZeroLayout,
new_layout: NonZeroLayout
) -> Result<NonNull<u8>, Self::Error>
impl<A: ReallocRef> ReallocRef for AbortAlloc<A>
[src]
unsafe fn realloc(
&mut self,
ptr: NonNull<u8>,
old_layout: NonZeroLayout,
new_layout: NonZeroLayout
) -> Result<NonNull<u8>, Self::Error>
[src]
&mut self,
ptr: NonNull<u8>,
old_layout: NonZeroLayout,
new_layout: NonZeroLayout
) -> Result<NonNull<u8>, Self::Error>