Skip to main content

smol_bytes/utf8_bytes_mut/
ops.rs

1use super::*;
2
3impl<I> core::ops::Index<I> for Utf8BytesMut
4where
5  I: core::slice::SliceIndex<str>,
6{
7  type Output = I::Output;
8
9  fn index(&self, index: I) -> &Self::Output {
10    &self.as_str()[index]
11  }
12}
13
14impl AsMut<str> for Utf8BytesMut {
15  fn as_mut(&mut self) -> &mut str {
16    self.as_mut_str()
17  }
18}
19
20impl core::borrow::BorrowMut<str> for Utf8BytesMut {
21  fn borrow_mut(&mut self) -> &mut str {
22    self.as_mut_str()
23  }
24}
25
26impl core::ops::DerefMut for Utf8BytesMut {
27  fn deref_mut(&mut self) -> &mut Self::Target {
28    self.as_mut_str()
29  }
30}
31
32impl<I> core::ops::IndexMut<I> for Utf8BytesMut
33where
34  I: core::slice::SliceIndex<str>,
35{
36  fn index_mut(&mut self, index: I) -> &mut Self::Output {
37    &mut self.as_mut_str()[index]
38  }
39}