Creating CString from nul-terminated data #73100
Labels
A-FFI
Area: Foreign function interface (FFI)
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
It seems there's no idiomatic way to create
CString
from nul-terminatedVec<u8>
. The only approriate way is topop()
last nul and thenfrom_vec_unchecked
will append a new one. Need the method just passes data as is (e.g.CString::from_vec_with_nul
such asCStr::from_bytes_with_nul
).Possibly, code should be like:
and safe version:
The text was updated successfully, but these errors were encountered: