diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs index 0a685e13f79a2..9b2187c71e212 100644 --- a/library/alloc/src/ffi/c_str.rs +++ b/library/alloc/src/ffi/c_str.rs @@ -818,6 +818,9 @@ impl From>> for CString { impl FromStr for CString { type Err = NulError; + /// Converts a string `s` into a [`CString`]. + /// + /// This method is equivalent to [`CString::new`]. #[inline] fn from_str(s: &str) -> Result { Self::new(s) @@ -827,6 +830,9 @@ impl FromStr for CString { impl TryInto for CString { type Error = IntoStringError; + /// Converts the `CString` into a [`String`] if it contains valid UTF-8 data. + /// + /// This method is equivalent to [`CString::into_string`]. #[inline] fn try_into(self) -> Result { self.into_string()