Trait map_in_place::MapBoxInPlace [] [src]

pub trait MapBoxInPlace<A> {
    fn map<B, F: FnOnce(A) -> B>(self, f: F) -> Box<B>;
    fn map_in_place<B, F: FnOnce(A) -> B>(self, f: F) -> Box<B>;
}

Required Methods

Replace the value with one that might have a different type.

If the types have identical size and alignment the heap allocation will be reused. If the closure then unwinds, the owned memory (but not the value, which the closure consumed) is leaked. This might change in the future.

Replace the value in the box with one that might be of another type as long the new type has identical size and alignment with the old one.

If the closure unwinds, the owned memory (but not the value, which the closure consumed) is leaked. This might change in the future.

Panics:

If the new type doesn't have the same size and alignment.

Implementors