We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 03ba7e7 commit 0265531Copy full SHA for 0265531
1 file changed
rust/kernel/str.rs
@@ -35,6 +35,12 @@ impl BStr {
35
// SAFETY: `BStr` is transparent to `[u8]`.
36
unsafe { &*(bytes as *const [u8] as *const BStr) }
37
}
38
+
39
+ /// Returns a reference to the inner [u8].
40
+ #[inline]
41
+ pub const fn deref_const(&self) -> &[u8] {
42
+ &self.0
43
+ }
44
45
46
impl fmt::Display for BStr {
@@ -106,7 +112,7 @@ impl Deref for BStr {
106
112
107
113
#[inline]
108
114
fn deref(&self) -> &Self::Target {
109
- &self.0
115
+ self.deref_const()
110
116
111
117
118
0 commit comments