ils> Returns a shared reference to the output at this location, if in
bounds. Read more Returns a mutable reference to the output at this location, if in
bounds. Read more Returns a shared reference to the output at this location, without
performing any bounds checking.
Calling this method with an out-of-bounds index or a dangling Returns a mutable reference to the output at this location, without
performing any bounds checking.
Calling this method with an out-of-bounds index or a dangling Implements substring slicing with syntax Returns a slice of the given string from the byte range
[ This operation is O(1). Prior to 1.20.0, these indexing operations were still supported by
direct implementation of Panics if Returns a shared reference to the output at this location, if in
bounds. Read more Returns a mutable reference to the output at this location, if in
bounds. Read more Returns a shared reference to the output at this location, without
performing any bounds checking.
Calling this method with an out-of-bounds index or a dangling Returns a mutable reference to the output at this location, without
performing any bounds checking.
Calling this method with an out-of-bounds index or a dangling impl<T> SliceIndex<[T]> for Range<usize>
fn get(self, slice: &[T]) -> Option<&[T]>
slice_index_methods
)fn get_mut(self, slice: &mut [T]) -> Option<&mut [T]>
slice_index_methods
)unsafe fn get_unchecked(self, slice: *const [T]) -> *const [T]
slice_index_methods
)slice
pointer
is undefined behavior even if the resulting reference is not used. Read moreunsafe fn get_unchecked_mut(self, slice: *mut [T]) -> *mut [T]
slice_index_methods
)slice
pointer
is undefined behavior even if the resulting reference is not used. Read moreimpl SliceIndex<str> for Range<usize>
&self[begin .. end]
or &mut self[begin .. end]
.begin
, end
).Index
and IndexMut
.Panics
begin
or end
does not point to the starting byte offset of
a character (as defined by is_char_boundary
), if begin > end
, or if
end > len
.Examples
Runlet s = "L枚we 鑰佽檸 L茅opard";
assert_eq!(&s[0 .. 1], "L");
assert_eq!(&s[1 .. 9], "枚we 鑰");
// these will panic:
// byte 2 lies within `枚`:
// &s[2 ..3];
// byte 8 lies within `鑰乣
// &s[1 .. 8];
// byte 100 is outside the string
// &s[3 .. 100];
fn get(self, slice: &str) -> Option<&Self::Output>
slice_index_methods
)fn get_mut(self, slice: &mut str) -> Option<&mut Self::Output>
slice_index_methods
)unsafe fn get_unchecked(self, slice: *const str) -> *const Self::Output
slice_index_methods
)slice
pointer
is undefined behavior even if the resulting reference is not used. Read moreunsafe fn get_unchecked_mut(self, slice: *mut str) -> *mut Self::Output
slice_index_methods
)slice
pointer
is undefined behavior even if the resulting reference is not used. Read moreimpl<Idx: Eq> Eq for Range<Idx>
impl<A: Step> FusedIterator for Range<A>
impl<Idx> StructuralEq for Range<Idx>
impl<Idx> StructuralPartialEq for Range<Idx>
impl<A: TrustedStep> TrustedLen for Range<A>
Mutably borrows from an owned value. Read more