Skip to content

Tracking Issue for slice::Split::as_slice() #96137

Open
@JulianKnodt

Description

@JulianKnodt

Feature gate: #![feature(split_as_slice)]

This is a tracking issue for:

Converting an iterator produced by .split(...) which is not fully consumed, into a slice, matching the APIs for .split(...) on Strings.

Public API

let a = [1,2,3];
let mut iter = a.split(|i| i == 2);
assert!(iter.next().is_some());
assert_eq!(iter.as_slice(), &[3]);

Steps / History

Unresolved Questions

Add impl:

#[stable(feature = "split_as_slice", since = "1.0.0")]
impl<'a, T: 'a, P: FnMut(&T) -> bool> AsRef<[T]> for Split<'a, T, P> {
    fn as_ref(&self) -> &'a [T] {
        self.as_slice()
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions