Method lrs::bx::Box::new

Creates a new box.

Syntax

impl<T, H> Box<T, H>
    where H: Allocator,
          <H as Allocator>::Pool: Default,
{
    fn new() -> Result<BoxBuf<T, H>, Errno>
}

Remarks

This function first creates an BoxBuf which can then be used to create a real Box as shown in the example. The function does not take a value argument itself since this would complicate handling the case where allocating memory fails. = Examples

let bx: Box<u8> = try!(Box::new()).set(0);