struct VecMappedInPlace<T, U> {
    ptr: *mut T,
    len: usize,
    cap: usize,
    map_in_progress: usize,
    _elem_tys: PhantomData<(T, U)>,
}
Expand description

Takes ownership of a Vec that is being mapped in place, cleaning up if the map fails.

Fields

ptr: *mut Tlen: usizecap: usizemap_in_progress: usize_elem_tys: PhantomData<(T, U)>

Implementations

Converts back into a Vec once the map is complete.

Trait Implementations

VecMappedInPlace drops everything but the element that was passed to map when it panicked or returned an error. Everything before that index in the vector has type U (it has been mapped) and everything after it has type T (it has not been mapped).

 mapped
 |      not yet mapped
 |----| |-----|
[UUUU UxTT TTTT]
       ^
   `map_in_progress` (not dropped)

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Cast a value to type U using CastTo.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.