Corelib
pub trait BoxTrait
Box
fn new(value: T) -> Box
let x = 42; let boxed_x = BoxTrait::new(x);
fn unbox(self: Box) -> T
let boxed = BoxTrait::new(42); assert!(boxed.unbox() == 42);
fn as_snapshot(self: @Box) -> Box
let snap_boxed_arr = @BoxTraits::new(array![1, 2, 3]); let boxed_snap_arr = snap_boxed_arr.as_snapshot(); let snap_arr = boxed_snap_arr.unbox();
Was this page helpful?