Open Frostie314159 opened 10 months ago
Regarding the CStr::from_bytes_with_nul_unchecked
, there exists a safe alternative: CStr::from_bytes_until_nul
, which basically replaces all checks, we do already. Full disclosure, this function eventually calls the unchecked version internally, but IMO it's better to let core
handle as much unsafe as possible, to profit from future optimizations.
sorry for late reply :) i agree with replacing CStr
impl, if there is a safe, std alternative, that seems good to me. as for others, well, I would have to see proposals :)
In the interest of exploring pure safe alternatives to unsafe functions, this issue tracks all uses and potential replacements. The unsafe portions are usually quite similar, so only one entry will be made per function.
transmute
#88copy_nonoverlapping
#104CStr::from_bytes_with_nul_unchecked