-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking Issue for slice_as_array
#133508
Comments
@RustyYato suggests the following signature for the pub fn into_array<const N: usize>(self) -> Result<Self<[T; N]>, Self<[T]>>; to prevent accidental leaks if conversion fails. Would this be preferred as-is or would a new error type (e.g. |
well, if you use |
Add `as_array` and `as_mut_array` conversion methods to slices. Tracking issue: rust-lang#133508 This PR unstably implements the `as_array` and `as_mut_array` converters to `[T]`, `*const [T]`, and `*mut [T]`.
Rollup merge of rust-lang#133512 - bjoernager:slice-as-array, r=Amanieu Add `as_array` and `as_mut_array` conversion methods to slices. Tracking issue: rust-lang#133508 This PR unstably implements the `as_array` and `as_mut_array` converters to `[T]`, `*const [T]`, and `*mut [T]`.
This comment has been minimized.
This comment has been minimized.
Fix docs for `<[T]>::as_array`. Tracking issue: rust-lang#133508 This PR fixes a small typographical error in the docs entry for `<[T]>::as_array`.
Rollup merge of rust-lang#133743 - bjoernager:slice-as-array, r=joboet Fix docs for `<[T]>::as_array`. Tracking issue: rust-lang#133508 This PR fixes a small typographical error in the docs entry for `<[T]>::as_array`.
I am aware that they mostly do not specialise any methods, but could (and should) we extend this to also include |
Add `into_array` conversion destructors for `Box`, `Rc`, and `Arc`. Tracking issue: rust-lang#133508 This PR adds the `into_array` destructor for `alloc::boxed::Box<[T]>`, `alloc::rc::Rc<[T]>`, and `alloc::sync::Arc<[T]>`. Note that this PR assumes the initial proposal of these functions returning `Option`. It is still an open question whether this should instead be `Result`. We can, however, easily change this in a follow-up PR with the necessary consensus.
Rollup merge of rust-lang#134379 - bjoernager:slice-as-array, r=dtolnay Add `into_array` conversion destructors for `Box`, `Rc`, and `Arc`. Tracking issue: rust-lang#133508 This PR adds the `into_array` destructor for `alloc::boxed::Box<[T]>`, `alloc::rc::Rc<[T]>`, and `alloc::sync::Arc<[T]>`. Note that this PR assumes the initial proposal of these functions returning `Option`. It is still an open question whether this should instead be `Result`. We can, however, easily change this in a follow-up PR with the necessary consensus.
Add `into_array` conversion destructors for `Box`, `Rc`, and `Arc`. Tracking issue: rust-lang#133508 This PR adds the `into_array` destructor for `alloc::boxed::Box<[T]>`, `alloc::rc::Rc<[T]>`, and `alloc::sync::Arc<[T]>`. Note that this PR assumes the initial proposal of these functions returning `Option`. It is still an open question whether this should instead be `Result`. We can, however, easily change this in a follow-up PR with the necessary consensus.
Feature gate:
#![feature(slice_as_array)]
This is a tracking issue for adding conversion functions from slices to arrays.
Public API
Steps / History
[T]
,*const [T]
, and*mut [T]
: Addas_array
andas_mut_array
conversion methods to slices. #133512<[T]>::as_array
: Fix docs for<[T]>::as_array
. #133743Box<[T]>
,Rc<[T]>
, andArc<[T]>
: Addinto_array
conversion destructors forBox
,Rc
, andArc
. #134379Unresolved Questions
const
-compatible for the non-primitive types?Option
orResult
for the owning conversions?Mutex
andRwLock
?The text was updated successfully, but these errors were encountered: