Skip to content

Commit

Permalink
Added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
YohDeadfall committed Sep 23, 2024
1 parent 6c8038d commit 3243cd9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions library/alloc/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,9 @@ impl From<Vec<NonZero<u8>>> 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, Self::Err> {
Self::new(s)
Expand All @@ -827,6 +830,9 @@ impl FromStr for CString {
impl TryInto<String> 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<String, Self::Error> {
self.into_string()
Expand Down

0 comments on commit 3243cd9

Please sign in to comment.