Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added documentation
Browse files Browse the repository at this point in the history
YohDeadfall committed Sep 23, 2024

Verified

This commit was signed with the committer’s verified signature.
snyk-bot Snyk bot
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
@@ -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)
@@ -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()

0 comments on commit 3243cd9

Please sign in to comment.