summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAlice Ryhl <aliceryhl@google.com>2023-05-03 14:10:16 +0000
committerMiguel Ojeda <ojeda@kernel.org>2023-05-31 18:53:10 +0200
commit66bd7533ef19bf8a3515ce702013aba368f58df3 (patch)
tree01750da9020ab71d9df5eedf7e4f82a3f794a2ed /lib
parent4a59081c09cbfe17505baf3db50ebb9b97290bae (diff)
downloadlinux-66bd7533ef19bf8a3515ce702013aba368f58df3.tar.gz
linux-66bd7533ef19bf8a3515ce702013aba368f58df3.tar.bz2
linux-66bd7533ef19bf8a3515ce702013aba368f58df3.zip
rust: str: add conversion from `CStr` to `CString`
These methods can be used to copy the data in a temporary c string into a separate allocation, so that it can be accessed later even if the original is deallocated. The API in this change mirrors the standard library API for the `&str` and `String` types. The `ToOwned` trait is not implemented because it assumes that allocations are infallible. Reviewed-by: Benno Lossin <benno.lossin@proton.me> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Reviewed-by: Andreas Hindborg <a.hindborg@samsung.com> Link: https://lore.kernel.org/r/20230503141016.683634-1-aliceryhl@google.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions