We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Index
BStr
1 parent 3eff946 commit 50a5ff0Copy full SHA for 50a5ff0
rust/kernel/str.rs
@@ -114,6 +114,17 @@ impl PartialEq for BStr {
114
}
115
116
117
+impl<Idx> Index<Idx> for BStr
118
+where
119
+ [u8]: Index<Idx, Output = [u8]>,
120
+{
121
+ type Output = Self;
122
+
123
+ fn index(&self, index: Idx) -> &Self::Output {
124
+ BStr::from_bytes(&self.0[index])
125
+ }
126
+}
127
128
/// Creates a new [`BStr`] from a string literal.
129
///
130
/// `b_str!` converts the supplied string literal to byte string, so non-ASCII
0 commit comments