about summary refs log tree commit diff
path: root/library/std/src/ffi/c_str
AgeCommit message (Collapse)AuthorLines
2022-04-14library: Move `CStr` to libcore, and `CString` to liballocVadim Petrochenkov-240/+0
2022-03-18add CStr::from_bytes_until_nulEric Seppanen-0/+37
This adds a member fn that converts a slice into a CStr; it is intended to be safer than from_ptr (which is unsafe and may read out of bounds), and more useful than from_bytes_with_nul (which requires that the caller already know where the nul byte is). feature gate: cstr_from_bytes_until_nul Also add an error type FromBytesUntilNulError for this fn.
2022-03-10Use implicit capture syntax in format_argsT-O-R-U-S-1/+1
This updates the standard library's documentation to use the new syntax. The documentation is worthwhile to update as it should be more idiomatic (particularly for features like this, which are nice for users to get acquainted with). The general codebase is likely more hassle than benefit to update: it'll hurt git blame, and generally updates can be done by folks updating the code if (and when) that makes things more readable with the new format. A few places in the compiler and library code are updated (mostly just due to already having been done when this commit was first authored).
2022-02-16Add debug asserts to validate NUL terminator in c stringsAlex Saveau-8/+0
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2021-03-28ffi::c_str added tests for empty stringsklensy-0/+16
2020-08-31std: move "mod tests/benches" to separate filesLzu Tao-0/+195
Also doing fmt inplace as requested.