Returns true
if item
is contained in the range.
assert!(!(3..5).contains(&2));\nassert!( (3..5).contains(&3));\nassert!( (3..5).contains(&4));\nassert!(!(3..5).contains(&5));\n\nassert!(!(3..3).contains(&3));\nassert!(!(3..2).contains(&3));\n\nassert!( (0.0..1.0).contains(&0.5));\nassert!(!(0.0..1.0).contains(&f32::NAN));\nassert!(!(0.0..f32::NAN).contains(&0.5));\nassert!(!(f32::NAN..1.0).contains(&0.5));
Returns true
if the range contains no items.
assert!(!(3..5).is_empty());\nassert!( (3..3).is_empty());\nassert!( (3..2).is_empty());
The range is empty if either side is incomparable:
\n\nassert!(!(3.0..5.0).is_empty());\nassert!( (3.0..f32::NAN).is_empty());\nassert!( (f32::NAN..5.0).is_empty());
is_sorted
)iter_advance_by
)n
elements. Read moreiter_next_chunk
)N
values. Read moreiter_intersperse
)separator
\nbetween adjacent items of the original iterator. Read moren
elements. Read moren
elements, or fewer\nif the underlying iterator ends sooner. Read moreiter_map_windows
)f
for each contiguous window of size N
over\nself
and returns an iterator over the outputs of f
. Like slice::windows()
,\nthe windows during mapping overlap as well. Read moreiter_collect_into
)iter_partition_in_place
)true
precede all those that return false
.\nReturns the number of true
elements found. Read moreiter_is_partitioned
)true
precede all those that return false
. Read moreiterator_try_reduce
)try_find
)iter_array_chunks
)N
elements of the iterator at a time. Read moreiter_order_by
)Iterator
with those\nof another with respect to the specified comparison function. Read morePartialOrd
elements of\nthis Iterator
with those of another. The comparison works like short-circuit\nevaluation, returning a result without comparing the remaining elements.\nAs soon as an order can be determined, the evaluation stops and a result is returned. Read moreiter_order_by
)Iterator
with those\nof another with respect to the specified comparison function. Read moreiter_order_by
)Iterator
are lexicographically\nless than those of another. Read moreIterator
are lexicographically\nless or equal to those of another. Read moreIterator
are lexicographically\ngreater than those of another. Read moreIterator
are lexicographically\ngreater than or equal to those of another. Read moreis_sorted
)is_sorted
)Implements substring slicing with syntax &self[begin .. end]
or &mut self[begin .. end]
.
Returns a slice of the given string from the byte range\n[begin
, end
).
This operation is O(1).
\nPrior to 1.20.0, these indexing operations were still supported by\ndirect implementation of Index
and IndexMut
.
Panics if begin
or end
does not point to the starting byte offset of\na character (as defined by is_char_boundary
), if begin > end
, or if\nend > len
.
let s = \"Löwe 老虎 Léopard\";\nassert_eq!(&s[0 .. 1], \"L\");\n\nassert_eq!(&s[1 .. 9], \"öwe 老\");\n\n// these will panic:\n// byte 2 lies within `ö`:\n// &s[2 ..3];\n\n// byte 8 lies within `老`\n// &s[1 .. 8];\n\n// byte 100 is outside the string\n// &s[3 .. 100];
slice_index_methods
)slice_index_methods
)slice_index_methods
)slice
pointer\nis undefined behavior even if the resulting reference is not used.slice_index_methods
)slice
pointer\nis undefined behavior even if the resulting reference is not used.slice_index_methods
)slice_index_methods
)slice_index_methods
)slice
pointer\nis undefined behavior even if the resulting reference is not used.slice_index_methods
)slice
pointer\nis undefined behavior even if the resulting reference is not used.n
th element from the end of the iterator. Read moreiter_advance_by
)n
elements. Read moreIterator::try_fold()
: it takes\nelements starting from the back of the iterator. Read more