Skip to content

Commit

Permalink
Implemented TryInto<String> for CString
Browse files Browse the repository at this point in the history
  • Loading branch information
YohDeadfall committed Sep 20, 2024
1 parent 5ca44de commit 6c8038d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions library/alloc/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,15 @@ impl FromStr for CString {
}
}

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

#[inline]
fn try_into(self) -> Result<String, Self::Error> {
self.into_string()
}
}

#[cfg(not(test))]
#[stable(feature = "more_box_slice_clone", since = "1.29.0")]
impl Clone for Box<CStr> {
Expand Down

0 comments on commit 6c8038d

Please sign in to comment.