Skip to content

Infallible Vec operations #341

Open
Open
@robin-nitrokey

Description

@robin-nitrokey

Some operations on a Vec<T, N> are infallible but can only be implemented using fallible methods. What do you think about adding more infallible methods? For example:

  • from_array(data: [T; N]): construct a Vec from an array with the same capacity (would also be useful for constants)
  • fill(&mut self, value: T): resize to capacity and clone value to empty slots
  • fill_default(&mut self): resize to capacity and write T::default() to empty slots
  • replace(&mut self, other: &Self): clear this Vec and copy the data from other

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions