rust-embedded / rust-embedded/heapless
Feature: add `Cow` type
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2k
- Forks
- 253
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 1
Description
It might be nice to have a Cow type in heapless.
pub enum Cow<'a, B, const N>
where
B: ToOwned,
{
Borrowed(&'a B),
Owned(<B as ToOwned>::Owned<N>),
}
Example
let string = heapless::Cow<'static, str, 8>;
let vec = heapless::Cow<'a, [u8], 16>;
But I'm not sure if this is actually a good idea because you have to allocate the entire Owned object anyway.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file, test, or entry point is named. Review the proposed Cow API and its Borrowed and Owned variants, then resolve whether allocating the full Owned object fits heapless before defining implementation scope and completion criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100