A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/rust-lang/rust/issues/133508 below:

Tracking Issue for `slice_as_array` · Issue #133508 · rust-lang/rust · GitHub

Feature gate: #![feature(slice_as_array)]

This is a tracking issue for adding conversion functions from slices to arrays.

Public API
impl<T> [T] {
    pub const fn as_array<const N: usize>(&self) -> Option<&[T; N]>;

    pub const fn as_mut_array<const N: usize>(&mut self) -> Option<&mut [T; N]>;
}

impl<T> *const [T] {
    pub const fn as_array<const N: usize>(self) -> Option<*const [T; N]>;
}

impl<T> *mut [T] {
    pub const fn as_mut_array<const N: usize>(self) -> Option<*mut [T; N]>;
}

// alloc::boxed

impl<T> Box<[T]> {
    pub fn into_array<const N: usize>(self) -> Result<Box<[T; N]>, Self>;
}

// alloc::rc

impl<T> Rc<[T]> {
    pub fn into_array<const N: usize>(self) -> Result<Rc<[T; N]>, Self>;
}

// alloc::sync

impl<T> Arc<[T]> {
    pub fn into_array<const N: usize>(self) -> Result<Arc<[T; N]>, Self>;
}
Steps / History Unresolved Questions

joseluis, YYMMYB, cxw620, MathiasPius, TheNullicorn and 2 more


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4