//! Utility functions for the most common UEFI patterns.
usealloc_api::{alloc::{handle_alloc_error, AllocRef, Global},boxed::Box,};usecore::alloc::Layout;/// Creates a boxed byte buffer using the standard allocator.
////// # Panics
////// Calls `handle_alloc_error` if the layout has a size of zero or allocation fails.
pubfnallocate_buffer(layout: Layout)->Box<[u8]>{if layout.size()==0{handle_alloc_error(layout);}unsafe{letmut slice =match Global.alloc(layout){Ok(slice)=> slice,Err(_)=>handle_alloc_error(layout),};Box::from_raw(slice.as_mut())}}