Skip to content

Add item predicate traits to slices, following CharEq for str #14612

Closed
@aturon

Description

@aturon

Several methods on the str type take a generic "predicate" on characters:

  • split and friends
  • trim_chars and friends
  • find and friends

The CharEq trait makes character predicates convenient by providing instances for char, various char -> bool function types, and slices of characters.

Vector slices should provide a similar interface. Right now, some of the relevant slice methods operate on individual items, while others take bool-producing functions.

Unfortunately, this is blocked on trait reform (#5527).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions