Support zero-allocation encoding into user-provided containers (for compatibility with runtimes like Monoio)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- rust
- Domain
- backend-api-design
Research direction
Start by tracing the existing buffer.encode(...) API and the ownership of its returned slice. Compare that path with the issue's proposed bitcode::encode_to(&my_data, &mut my_buf) usage and determine the API and encoding behavior needed for an owned container. Done means callers can encode into a user-provided buffer and retain ownership for an operation such as Monoio socket.send.
Written by the indexing model from the issue text.
Description
It would be very helpful to have the ability to encode data directly into a user-provided, owned container, rather than being limited to buffer.encode(…) -> &'_ [u8].
Reasoning:
Some async runtimes, such as monoio, require owned containers for I/O operations. Currently, code like the following does not work because buffer.encode returns a borrowed slice:
let data = buffer.encode(&my_data);
let (res, _) = socket.send(data).await;
It would be ideal if the API allowed encoding directly into a user-provided buffer, for example:
let mut my_buf = Vec::with_capacity(1024);
…
bitcode::encode_to(&my_data, &mut my_buf);
let (res, ret_my_buf) = socket.send(my_buf).await;
my_buf = ret_my_buf;
- Dominant language
- Rust
- Stars
- 671
- Forks
- 61
- PR merge metrics
- No merged PRs in 30d
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.
More from SoftbearStudios/bitcode
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
SoftbearStudios/bitcode#122 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
SoftbearStudios/bitcode#121 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
SoftbearStudios/bitcode#115 · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
SoftbearStudios/bitcode#110 · 1 reaction ·
-
BUffer for serde? Open
SoftbearStudios/bitcode#102 · 1 comment · 1 assignee ·
All issues in SoftbearStudios/bitcode
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100