Tracking Issue for slice_as_array · Issue #133508 · rust-lang/rust (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@bjoernager

Description

@bjoernager

Feature gate: #![feature(slice_as_array)]

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

Public API

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

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

}

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

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

// alloc::boxed

impl Box<[T]> { pub fn into_array(self) -> Option<Box<[T; N]>>; }

// alloc::rc

impl Rc<[T]> { pub fn into_array(self) -> Option<Rc<[T; N]>>; }

// alloc::sync

impl Arc<[T]> { pub fn into_array(self) -> Option<Arc<[T; N]>>; }

Steps / History

Unresolved Questions