Struct varlen::array_init::MoveFrom
source · [−]Expand description
Fills an array by moving from a source array. Source and destination must have identical length.
Examples
use varlen::prelude::*;
let src = ["hello".to_string(), "world".to_string()];
let arr: [String; 2] = new_array(MoveFrom(src));
assert_eq!(arr, ["hello".to_string(), "world".to_string()]);
Panics
Panics if the source and destination have different lengths.
ⓘ
let arr: [String; 1] = new_array(MoveFrom(src)); // Panics
Tuple Fields
0: [T; N]
Trait Implementations
sourceimpl<T, const N: usize> ArrayInitializer<T> for MoveFrom<T, N>
impl<T, const N: usize> ArrayInitializer<T> for MoveFrom<T, N>
sourcefn initialize(self, dst: &mut [MaybeUninit<T>])
fn initialize(self, dst: &mut [MaybeUninit<T>])
Fills the slice. Read more
Auto Trait Implementations
impl<T, const N: usize> RefUnwindSafe for MoveFrom<T, N> where
T: RefUnwindSafe,
impl<T, const N: usize> Send for MoveFrom<T, N> where
T: Send,
impl<T, const N: usize> Sync for MoveFrom<T, N> where
T: Sync,
impl<T, const N: usize> Unpin for MoveFrom<T, N> where
T: Unpin,
impl<T, const N: usize> UnwindSafe for MoveFrom<T, N> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more