rust-embedded / rust-embedded/heapless

Infallible Vec operations

Open
#341 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
2k
Forks
253
Avg merge
1d 2h
Merged PRs (30d)
1

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the existing fallible Vec<T, N> methods and the four proposed operations: from_array, fill, fill_default, and replace. Compare their intended behavior with the no-std, static-friendly constraints, then determine the API and tests needed for each method; done means the infallible operations are implemented with agreed semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.