Skip to main content

just_string/
traits_i.rs

1use std::{
2    ops::{Deref, Index},
3    slice::SliceIndex,
4};
5
6use crate::JustString;
7
8impl<I> Index<I> for JustString<'_>
9where
10    I: SliceIndex<str>,
11{
12    type Output = <I as SliceIndex<str>>::Output;
13
14    fn index(&self, index: I) -> &Self::Output {
15        &self.deref()[index]
16    }
17}