Skip to content

Conversation

@JarredAllen
Copy link
Contributor

I implemented the slice methods described in my ACP rust-lang/libs-team#543:

impl<T> [T] {
    pub const fn split_off_first_chunk<'a, const N: usize>(self: &mut &'a Self) -> Option<&'a [T; N]>;
    pub const fn split_off_first_chunk_mut<'a, const N: usize>(self: &mut &'a mut Self) -> Option<&'a mut [T; N]>;
    pub const fn split_off_last_chunk<'a, const N: usize>(self: &mut &'a Self) -> Option<&'a [T; N]>;
    pub const fn split_off_last_chunk_mut<'a, const N: usize>(self: &mut &'a mut Self) -> Option<&'a mut [T; N]>;
}

The only difference from my original ACP post was that I put the first/last before chunk in the name instead of after it. My default intuition when I wrote that ACP was to have the names all appear next to each other alphabetically, but as I was implementing it I checked for similar-looking functions, and I found that split_first_chunk and related methods (which are basically these methods but without the in-place modification of self) do the other order and I decided it would be better to match how the other functions are named.

This is my first PR into rust itself, so I did my best to figure out the norms (both for the process around making a PR and the code I put in the PR) and follow them, but I probably got some stuff wrong so I'm sorry in advance for whatever I got wrong.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 18, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants