From 39b391d0a89cc5712e092b9944f6d326433e6903 Mon Sep 17 00:00:00 2001 From: Yoh Deadfall Date: Mon, 23 Sep 2024 21:34:10 +0300 Subject: [PATCH] Added documentation --- library/alloc/src/ffi/c_str.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs index 0a685e13f79a..3550a2b40b09 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) @@ -828,6 +831,9 @@ impl TryInto for CString { type Error = IntoStringError; #[inline] + /// Converts the `CString` into a [`String`] if it contains valid UTF-8 data. + /// + /// This method is equivalent to [`CString::into_string`]. fn try_into(self) -> Result { self.into_string() }