unsafe fn grow_in_place(&mut self,
                            ptr: NonNull<u8>,
                            layout: Layout,
                            new_size: usize) -> Result<(), CannotReallocInPlace> {
        let _ = ptr; // this default implementation doesn't care about the actual address.
        debug_assert!(new_size >= layout.size());
        let (_l, u) = self.usable_size(&layout);
        // _l <= layout.size()                       [guaranteed by usable_size()]
        //       layout.size() <= new_layout.size()  [required by this method]
        if new_size <= u {
            Ok(())
        } else {
            Err(CannotReallocInPlace)
        }
    }
/// Attempts to extend the allocation referenced by `ptr` to fit `new_size`.
///
/// If this returns `Ok`, then the allocator has asserted that the
/// memory block referenced by `ptr` now fits `new_size`, and thus can
/// be used to carry data of a layout of that size and same alignment as
/// `layout`. (The allocator is allowed to
/// expend effort to accomplish this, such as extending the memory block to
/// include successor blocks, or virtual memory tricks.)
///
/// Regardless of what this method returns, ownership of the
/// memory block referenced by `ptr` has not been transferred, and
/// the contents of the memory block are unaltered.
///
/// # Safety
///
/// This function is unsafe because undefined behavior can result
/// if the caller does not ensure all of the following:
///
/// * `ptr` must be currently allocated via this allocator,
///
/// * `layout` must *fit* the `ptr` (see above); note the
///   `new_size` argument need not fit it,
///
/// * `new_size` must not be less than `layout.size()`,
///
/// # Errors
///
/// Returns `Err(CannotReallocInPlace)` when the allocator is
/// unable to assert that the memory block referenced by `ptr`
/// could fit `layout`.
///
/// Note that one cannot pass `CannotReallocInPlace` to the `handle_alloc_error`
/// function; clients are expected either to be able to recover from
/// `grow_in_place` failures without aborting, or to fall back on
/// another reallocation method before resorting to an abort.
Attempts to extend the allocation referenced by `ptr` to fit `new_size`.

Regardless of what this method returns, ownership of the
memory block referenced by `ptr` has not been transferred, and
the contents of the memory block are unaltered.
Attempts to extend the allocation referenced by ` ptr ` to fit ` new_size ` . Regardless of what this method returns ownership of the memory block referenced by ` ptr ` has not been transferred and the contents of the memory block are unaltered .
unsafe fn grow_in_place(&mut self,
                            ptr: NonNull<u8>,
                            layout: Layout,
                            new_size: usize) -> Result<(), CannotReallocInPlace> {
        let _ = ptr; // this default implementation doesn't care about the actual address.
        debug_assert!(new_size >= layout.size());
        let (_l, u) = self.usable_size(&layout);
        // _l <= layout.size()                       [guaranteed by usable_size()]
        //       layout.size() <= new_layout.size()  [required by this method]
        if new_size <= u {
            Ok(())
        } else {
            Err(CannotReallocInPlace)
        }
    }
unsafe fn grow_in_place ( & mut self , ptr : NonNull < u8 > , layout : Layout , new_size : usize ) -> Result < ( ) , CannotReallocInPlace > { let _ = ptr ; // this default implementation doesn't care about the actual address. debug_assert ! ( new_size layout size ( ) ) ; let ( _l , u ) = self . usable_size ( & layout ) ; // _l <= layout.size()                       [guaranteed by usable_size()] //       layout.size() <= new_layout.size()  [required by this method] if new_size <= u { Ok ( ( ) ) } else { Err ( CannotReallocInPlace ) } }
Attempts to extend the allocation referenced by `ptr` to fit `new_size`.
Attempts to extend the allocation referenced by ` ptr ` to fit ` new_size ` .
&mut self
ptr
NonNull<u8>
layout
Layout
new_size
usize
&mut self
ptr
NonNull<u8>
layout
Layout
new_size
usize
safety
This function is unsafe because undefined behavior can result
if the caller does not ensure all of the following.

`ptr` must be currently allocated via this allocator.

`layout` must *fit* the `ptr` ; note the
`new_size` argument need not fit it.

`new_size` must not be less than `layout.size()`.
This function is unsafe because undefined behavior can result if the caller does not ensure all of the following . ` ptr ` must be currently allocated via this allocator . ` layout ` must * fit * the ` ptr ` ; note the ` new_size ` argument need not fit it . ` new_size ` must not be less than ` layout . size () ` .
errors
Returns `Err(CannotReallocInPlace)` when the allocator is
unable to assert that the memory block referenced by `ptr`
could fit `layout`.

Note that one cannot pass `CannotReallocInPlace` to the `handle_alloc_error`
function; clients are expected either to be able to recover from
`grow_in_place` failures without aborting, or to fall back on
another reallocation method before resorting to an abort.
Returns ` Err ( CannotReallocInPlace ) ` when the allocator is unable to assert that the memory block referenced by ` ptr ` could fit ` layout ` . Note that one cannot pass ` CannotReallocInPlace ` to the ` handle_alloc_error ` function ; clients are expected either to be able to recover from ` grow_in_place ` failures without aborting or to fall back on another reallocation method before resorting to an abort .