Skip to content

Commit

Permalink
Implemented TryFrom instead of TryInto
Browse files Browse the repository at this point in the history
  • Loading branch information
YohDeadfall committed Sep 25, 2024
1 parent 3243cd9 commit a0b4219
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions library/alloc/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,15 +827,15 @@ impl FromStr for CString {
}
}

impl TryInto<String> for CString {
impl TryFrom<CString> for String {
type Error = IntoStringError;

/// Converts the `CString` into a [`String`] if it contains valid UTF-8 data.
/// Converts a [`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()
fn try_from(value: CString) -> Result<Self, Self::Error> {
value.into_string()
}
}

Expand Down

0 comments on commit a0b4219

Please sign in to comment.