Skip to content

Commit 3243cd9

Browse files
committed
Added documentation
1 parent 6c8038d commit 3243cd9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: library/alloc/src/ffi/c_str.rs

+6
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,9 @@ impl From<Vec<NonZero<u8>>> for CString {
818818
impl FromStr for CString {
819819
type Err = NulError;
820820

821+
/// Converts a string `s` into a [`CString`].
822+
///
823+
/// This method is equivalent to [`CString::new`].
821824
#[inline]
822825
fn from_str(s: &str) -> Result<Self, Self::Err> {
823826
Self::new(s)
@@ -827,6 +830,9 @@ impl FromStr for CString {
827830
impl TryInto<String> for CString {
828831
type Error = IntoStringError;
829832

833+
/// Converts the `CString` into a [`String`] if it contains valid UTF-8 data.
834+
///
835+
/// This method is equivalent to [`CString::into_string`].
830836
#[inline]
831837
fn try_into(self) -> Result<String, Self::Error> {
832838
self.into_string()

0 commit comments

Comments
 (0)