[][src]Trait default_boxed::DefaultBoxed

pub trait DefaultBoxed: Sized {
    unsafe fn default_in_place(ptr: *mut Self);

    fn default_boxed() -> Box<Self> { ... }
}

Helper trait to create a boxed instance of the given type with a default value for each field.

This trait can be derived.

To derive this trait, each field needs to also implement this trait, but all types which implements Default implements this trait via the blanket impl already.

In addition, if a field is an array, only the item type needs to implement this trait, and each item would be initialized separately.

Required methods

unsafe fn default_in_place(ptr: *mut Self)

Loading content...

Provided methods

fn default_boxed() -> Box<Self>

Loading content...

Implementors

impl<T: Default> DefaultBoxed for T[src]

Loading content...