Skip to content

Commit cc7929b

Browse files
committed
docs(std): add docs for cof_from_cstr impls
CC #51430
1 parent ef44452 commit cc7929b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

library/std/src/ffi/c_str.rs

+3
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,7 @@ impl From<CString> for Box<CStr> {
915915

916916
#[stable(feature = "cow_from_cstr", since = "1.28.0")]
917917
impl<'a> From<CString> for Cow<'a, CStr> {
918+
/// Converts a [`CString`] into an owned [`Cow`] without copying or allocating.
918919
#[inline]
919920
fn from(s: CString) -> Cow<'a, CStr> {
920921
Cow::Owned(s)
@@ -923,6 +924,7 @@ impl<'a> From<CString> for Cow<'a, CStr> {
923924

924925
#[stable(feature = "cow_from_cstr", since = "1.28.0")]
925926
impl<'a> From<&'a CStr> for Cow<'a, CStr> {
927+
/// Converts a [`CStr`] into a borrowed [`Cow`] without copying or allocating.
926928
#[inline]
927929
fn from(s: &'a CStr) -> Cow<'a, CStr> {
928930
Cow::Borrowed(s)
@@ -931,6 +933,7 @@ impl<'a> From<&'a CStr> for Cow<'a, CStr> {
931933

932934
#[stable(feature = "cow_from_cstr", since = "1.28.0")]
933935
impl<'a> From<&'a CString> for Cow<'a, CStr> {
936+
/// Converts a `&`[`CString`] into a borrowed [`Cow`] without copying or allocating.
934937
#[inline]
935938
fn from(s: &'a CString) -> Cow<'a, CStr> {
936939
Cow::Borrowed(s.as_c_str())

0 commit comments

Comments
 (0)