3

std::array::IntoIter - Rust

 3 years ago
source link: https://doc.rust-lang.org/stable/std/array/struct.IntoIter.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

impl<T, const N: usize> IntoIter<T, N>[src][−]

pub fn new(array: [T; N]) -> IntoIter<T, N>ⓘ[src][−]

Creates a new iterator over the given array.

Note: this method might be deprecated in the future, after IntoIterator is implemented for arrays.

Examples

use std::array;

for value in array::IntoIter::new([1, 2, 3, 4, 5]) {
    // The type of `value` is a `i32` here, instead of `&i32`
    let _: i32 = value;
}
Run

pub fn as_slice(&self) -> &[T][src][−]

Returns an immutable slice of all elements that have not been yielded yet.

pub fn as_mut_slice(&mut self) -> &mut [T][src][−]

Returns a mutable slice of all elements that have not been yielded yet.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK