free

Function free 

Source
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 alloc function.
  • Providing NULL is safe and will return Err(DeallocationError::NullPtr).
  • Providing any other pointer causes undefined behaviour.

§Errors

  • Returns Err(DeallocationError) if a safety check fails.