Skip to content

Commit

Permalink
sl-std: impl IndexMut for ascii::Str
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwuelker committed Jul 23, 2024
1 parent 8ba6ccb commit 06c153f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions crates/sl-std/src/ascii/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,21 @@ where
}
}

impl ops::IndexMut<usize> for Str {
fn index_mut(&mut self, index: usize) -> &mut Self::Output {
&mut self.chars_mut()[index]
}
}

impl<T> ops::IndexMut<T> for Str
where
T: SliceIndex<Str, Output = Str>,
{
fn index_mut(&mut self, index: T) -> &mut Self::Output {
index.index_mut(self)
}
}

impl<'a> TryFrom<&'a [u8]> for &'a Str {
type Error = NotAscii;

Expand Down

0 comments on commit 06c153f

Please sign in to comment.