pub fn free<T>(ptr: *mut T) -> Result<(), DeallocationError>Expand description
- A reasonably safe implementation of
free. - This function will free a pointer allocated by
alloc. - Caller guarantees that the provided pointer was allocated by this crate’s
allocfunction. - Providing
NULLis safe and will returnErr(DeallocationError::NullPtr). - Providing any other pointer causes undefined behaviour.
§Errors
- Returns
Err(DeallocationError)if a safety check fails.