[][src]Function pebble_skip::standard_c::memory::resize_realloc

pub unsafe fn resize_realloc<'a, T>(
    buffer: &'static mut [T],
    new_len: usize
) -> Result<ReallocOk<'a, T>, ReallocError<'a, T>>

Resizes a buffer, possibly moving it in the process. If new_len < buffer.len(), that is if the buffer is to be shrunk, any extra elements are dropped before this is attempted.

In cases where buffer.len() == new_len, both Ok and Err contain the &mut [T] variant.
See ReallocOk and ReallocError for more information.

Safety

This function is only safe iff buffer was obtained from an allocation function in this module.

Errors

ReallocError, iff the reallocation fails. If the buffer fails to grow, you get the original back.

If the buffer fails to shrink, you still get the original back, but any elements beyond the first new_len ones will have been dropped.

Panics

If there is an arithmetic overflow regarding usize to isize conversions or pointer offset calculations.