We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f7b4354 commit 85688d8Copy full SHA for 85688d8
library/core/src/ffi/c_str.rs
@@ -710,6 +710,14 @@ impl AsRef<CStr> for CStr {
710
}
711
712
713
+impl ops::Deref for CStr {
714
+ type Target = crate::bstr::ByteStr;
715
+
716
+ fn deref(&self) -> &Self::Target {
717
+ crate::bstr::ByteStr::from_bytes(self.to_bytes())
718
+ }
719
+}
720
721
/// Calculate the length of a nul-terminated string. Defers to C's `strlen` when possible.
722
///
723
/// # Safety
0 commit comments