Skip to content

Cstring into Vec or String#639

Merged
sgued merged 6 commits intorust-embedded:mainfrom
johann-cm:cstring_into_vec_or_string
Jan 20, 2026
Merged

Cstring into Vec or String#639
sgued merged 6 commits intorust-embedded:mainfrom
johann-cm:cstring_into_vec_or_string

Conversation

@johann-cm
Copy link
Contributor

I've implemented the methods into_bytes, into_bytes_with_nul, and into_string, which are present in the std::ffi::CString.

I've also added thiserror as a dependency to neatly derive the Error trait on the IntoStringError struct.
If you prefer to keep dependencies to an absolute minimum, I can also remove thiserror and implement the Error trait by hand.

Copy link
Contributor

@zeenix zeenix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Co-authored-by: Soso <51865119+sgued@users.noreply.github.com>
Copy link
Contributor

@zeenix zeenix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I promise, last nicpick. :)

Co-authored-by: Zeeshan Ali Khan <zeenix@gmail.com>
Copy link
Contributor

@zeenix zeenix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@sgued sgued added this pull request to the merge queue Jan 20, 2026
Merged via the queue into rust-embedded:main with commit b8fa753 Jan 20, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants