oxidecomputer / oxidecomputer/usdt

Support CStr

Open
#487 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
145
Forks
15
Avg merge
14m
Merged PRs (30d)
6

Description

I noticed that passing &str or String requires converting to a &[u8] where you then push a nul byte. It would be nice to support CStr as well to avoid this alloc.

Additionally, instead of doing

// args.1: String
let arg_1 = [(args.1.as_ref() as &str).as_bytes(), &[0_u8]].concat();

it would likely be better instead to do

let arg_1 = {
    let mut bytes = args.1.into_bytes();
    bytes.push(0);
    bytes
};

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

The issue names no files or tests. Start by locating the argument conversion path that handles &str and String, then inspect nearby tests or examples for supported argument types. Done means CStr is accepted without the caller needing to construct a nul-terminated byte buffer, while the suggested String conversion is addressed as appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools, observability-sre
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.