Struct varlen::array_init::CopyFrom
source · [−]pub struct CopyFrom<'a, T>(pub &'a [T]);
Expand description
Fills an array by copying from a source array. Source and destination must have identical length.
Examples
use varlen::prelude::*;
let arr: [u16; 5] = new_array(CopyFrom(&[3, 1, 4, 1, 5]));
assert_eq!(arr, [3, 1, 4, 1, 5]);
Panics
Panics if the source and destination arrays have different length.
ⓘ
use varlen::prelude::*;
let arr: [u16; 6] = new_array(CopyFrom(&[3, 1, 4, 1, 5])); // Panic
ⓘ
use varlen::prelude::*;
let arr: [u16; 4] = new_array(CopyFrom(&[3, 1, 4, 1, 5])); // Panic
Tuple Fields
0: &'a [T]
Trait Implementations
sourceimpl<'a, T: Copy> ArrayInitializer<T> for CopyFrom<'a, T>
impl<'a, T: Copy> ArrayInitializer<T> for CopyFrom<'a, T>
sourcefn initialize(self, dst: &mut [MaybeUninit<T>])
fn initialize(self, dst: &mut [MaybeUninit<T>])
Fills the slice. Read more
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for CopyFrom<'a, T> where
T: RefUnwindSafe,
impl<'a, T> Send for CopyFrom<'a, T> where
T: Sync,
impl<'a, T> Sync for CopyFrom<'a, T> where
T: Sync,
impl<'a, T> Unpin for CopyFrom<'a, T>
impl<'a, T> UnwindSafe for CopyFrom<'a, T> where
T: RefUnwindSafe,
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