We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6c8038d commit 39b391dCopy full SHA for 39b391d
library/alloc/src/ffi/c_str.rs
@@ -818,6 +818,9 @@ impl From<Vec<NonZero<u8>>> for CString {
818
impl FromStr for CString {
819
type Err = NulError;
820
821
+ /// Converts a string `s` into a [`CString`].
822
+ ///
823
+ /// This method is equivalent to [`CString::new`].
824
#[inline]
825
fn from_str(s: &str) -> Result<Self, Self::Err> {
826
Self::new(s)
@@ -828,6 +831,9 @@ impl TryInto<String> for CString {
828
831
type Error = IntoStringError;
829
832
830
833
834
+ /// Converts the `CString` into a [`String`] if it contains valid UTF-8 data.
835
836
+ /// This method is equivalent to [`CString::into_string`].
837
fn try_into(self) -> Result<String, Self::Error> {
838
self.into_string()
839
}
0 commit comments