unsafe fn alloc_zeroed(&mut self, layout: Layout) -> Result<NonNull<u8>, AllocErr> {
        let size = layout.size();
        let p = self.alloc(layout);
        if let Ok(p) = p {
            ptr::write_bytes(p.as_ptr(), 0, size);
        }
        p
    }
/// Behaves like `alloc`, but also ensures that the contents
/// are set to zero before being returned.
///
/// # Safety
///
/// This function is unsafe for the same reasons that `alloc` is.
///
/// # Errors
///
/// Returning `Err` indicates that either memory is exhausted or
/// `layout` does not meet allocator's size or alignment
/// constraints, just as in `alloc`.
///
/// Clients wishing to abort computation in response to an
/// allocation error are encouraged to call the [`handle_alloc_error`] function,
/// rather than directly invoking `panic!` or similar.
///
/// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html
Behaves like `alloc`, but also ensures that the contents
are set to zero before being returned.
Behaves like ` alloc ` but also ensures that the contents are set to zero before being returned .
unsafe fn alloc_zeroed(&mut self, layout: Layout) -> Result<NonNull<u8>, AllocErr> {
        let size = layout.size();
        let p = self.alloc(layout);
        if let Ok(p) = p {
            ptr::write_bytes(p.as_ptr(), 0, size);
        }
        p
    }
unsafe fn alloc_zeroed ( & mut self , layout : Layout ) -> Result < NonNull < u8 > , AllocErr > { let size = layout . size ( ) ; let p = self . alloc ( layout ) ; if let Ok ( p ) = p { ptr :: write_bytes ( p . as_ptr ( ) , 0 , size ) ; } p }
Behaves like `alloc`, but also ensures that the contents
are set to zero before being returned.
Behaves like ` alloc ` but also ensures that the contents are set to zero before being returned .
&mut self
layout
Layout
&mut self
layout
Layout
safety
This function is unsafe for the same reasons that `alloc` is.
This function is unsafe for the same reasons that ` alloc ` is .
errors
Returning `Err` indicates that either memory is exhausted or
`layout` does not meet allocator's size or alignment
constraints, just as in `alloc`.

Clients wishing to abort computation in response to an
allocation error are encouraged to call the [`handle_alloc_error`] function,
rather than directly invoking `panic!` or similar.

[`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html
Returning ` Err ` indicates that either memory is exhausted or ` layout ` does not meet allocator ' s size or alignment constraints just as in ` alloc ` . Clients wishing to abort computation in response to an allocation error are encouraged to call the [ ` handle_alloc_error ` ] function rather than directly invoking ` panic! ` or similar . [ ` handle_alloc_error ` ] : .. / .. / alloc / alloc / fn . handle_alloc_error . html