Movatterモバイル変換


[0]ホーム

URL:


Range

std::ops

StructRange 

1.0.0 ·Source
pub struct Range<Idx> {    pub start: Idx,    pub end: Idx,}
Expand description

A (half-open) range bounded inclusively below and exclusively above(start..end).

The rangestart..end contains all values withstart <= x < end.It is empty ifstart >= end.

§Examples

Thestart..end syntax is aRange:

assert_eq!((3..5), std::ops::Range { start:3, end:5});assert_eq!(3+4+5, (3..6).sum());
letarr = [0,1,2,3,4];assert_eq!(arr[ ..  ], [0,1,2,3,4]);assert_eq!(arr[ ..3], [0,1,2]);assert_eq!(arr[ ..=3], [0,1,2,3]);assert_eq!(arr[1..  ], [1,2,3,4]);assert_eq!(arr[1..3], [1,2]);// This is a `Range`assert_eq!(arr[1..=3], [1,2,3]);

Fields§

§start: Idx

The lower bound of the range (inclusive).

§end: Idx

The upper bound of the range (exclusive).

Implementations§

Source§

impl<Idx>Range<Idx>
where Idx:PartialOrd,

1.35.0 (const: unstable) ·Source

pub fncontains<U>(&self, item:&U) ->bool
where Idx:PartialOrd<U>, U:PartialOrd<Idx> + ?Sized,

Returnstrue ifitem is contained in the range.

§Examples
assert!(!(3..5).contains(&2));assert!( (3..5).contains(&3));assert!( (3..5).contains(&4));assert!(!(3..5).contains(&5));assert!(!(3..3).contains(&3));assert!(!(3..2).contains(&3));assert!( (0.0..1.0).contains(&0.5));assert!(!(0.0..1.0).contains(&f32::NAN));assert!(!(0.0..f32::NAN).contains(&0.5));assert!(!(f32::NAN..1.0).contains(&0.5));
1.47.0 (const: unstable) ·Source

pub fnis_empty(&self) ->bool
where Idx:PartialOrd,

Returnstrue if the range contains no items.

§Examples
assert!(!(3..5).is_empty());assert!( (3..3).is_empty());assert!( (3..2).is_empty());

The range is empty if either side is incomparable:

assert!(!(3.0..5.0).is_empty());assert!( (3.0..f32::NAN).is_empty());assert!( (f32::NAN..5.0).is_empty());

Trait Implementations§

1.0.0 (const:unstable) ·Source§

impl<Idx>Clone forRange<Idx>
where Idx:Clone,

Source§

fnclone(&self) ->Range<Idx>

Returns a duplicate of the value.Read more
1.0.0 ·Source§

fnclone_from(&mut self, source: &Self)

Performs copy-assignment fromsource.Read more
1.0.0 ·Source§

impl<Idx>Debug forRange<Idx>
where Idx:Debug,

Source§

fnfmt(&self, fmt: &mutFormatter<'_>) ->Result<(),Error>

Formats the value using the given formatter.Read more
1.0.0 (const:unstable) ·Source§

impl<Idx>Default forRange<Idx>
where Idx:Default,

Source§

fndefault() ->Range<Idx>

Returns the “default value” for a type.Read more
1.0.0 ·Source§

impl<A>DoubleEndedIterator forRange<A>
where A:Step,

Source§

fnnext_back(&mut self) ->Option<A>

Removes and returns an element from the end of the iterator.Read more
Source§

fnnth_back(&mut self, n:usize) ->Option<A>

Returns thenth element from the end of the iterator.Read more
Source§

fnadvance_back_by(&mut self, n:usize) ->Result<(),NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by #77404)
Advances the iterator from the back byn elements.Read more
1.27.0 ·Source§

fntry_rfold<B, F, R>(&mut self, init: B, f: F) -> R
where Self:Sized, F:FnMut(B, Self::Item) -> R, R:Try<Output = B>,

This is the reverse version ofIterator::try_fold(): it takeselements starting from the back of the iterator.Read more
1.27.0 ·Source§

fnrfold<B, F>(self, init: B, f: F) -> B
where Self:Sized, F:FnMut(B, Self::Item) -> B,

An iterator method that reduces the iterator’s elements to a single,final value, starting from the back.Read more
1.27.0 ·Source§

fnrfind<P>(&mut self, predicate: P) ->Option<Self::Item>
where Self:Sized, P:FnMut(&Self::Item) ->bool,

Searches for an element of an iterator from the back that satisfies a predicate.Read more
1.0.0 ·Source§

implExactSizeIterator forRange<i16>

1.0.0 ·Source§

fnlen(&self) ->usize

Returns the exact remaining length of the iterator.Read more
Source§

fnis_empty(&self) ->bool

🔬This is a nightly-only experimental API. (exact_size_is_empty #35428)
Returnstrue if the iterator is empty.Read more
1.0.0 ·Source§

implExactSizeIterator forRange<i32>

1.0.0 ·Source§

fnlen(&self) ->usize

Returns the exact remaining length of the iterator.Read more
Source§

fnis_empty(&self) ->bool

🔬This is a nightly-only experimental API. (exact_size_is_empty #35428)
Returnstrue if the iterator is empty.Read more
1.0.0 ·Source§

implExactSizeIterator forRange<i8>

1.0.0 ·Source§

fnlen(&self) ->usize

Returns the exact remaining length of the iterator.Read more
Source§

fnis_empty(&self) ->bool

🔬This is a nightly-only experimental API. (exact_size_is_empty #35428)
Returnstrue if the iterator is empty.Read more
1.0.0 ·Source§

implExactSizeIterator forRange<isize>

1.0.0 ·Source§

fnlen(&self) ->usize

Returns the exact remaining length of the iterator.Read more
Source§

fnis_empty(&self) ->bool

🔬This is a nightly-only experimental API. (exact_size_is_empty #35428)
Returnstrue if the iterator is empty.Read more
1.0.0 ·Source§

implExactSizeIterator forRange<u16>

1.0.0 ·Source§

fnlen(&self) ->usize

Returns the exact remaining length of the iterator.Read more
Source§

fnis_empty(&self) ->bool

🔬This is a nightly-only experimental API. (exact_size_is_empty #35428)
Returnstrue if the iterator is empty.Read more
1.0.0 ·Source§

implExactSizeIterator forRange<u32>

1.0.0 ·Source§

fnlen(&self) ->usize

Returns the exact remaining length of the iterator.Read more
Source§

fnis_empty(&self) ->bool

🔬This is a nightly-only experimental API. (exact_size_is_empty #35428)
Returnstrue if the iterator is empty.Read more
1.0.0 ·Source§

implExactSizeIterator forRange<u8>

1.0.0 ·Source§

fnlen(&self) ->usize

Returns the exact remaining length of the iterator.Read more
Source§

fnis_empty(&self) ->bool

🔬This is a nightly-only experimental API. (exact_size_is_empty #35428)
Returnstrue if the iterator is empty.Read more
1.0.0 ·Source§

implExactSizeIterator forRange<usize>

1.0.0 ·Source§

fnlen(&self) ->usize

Returns the exact remaining length of the iterator.Read more
Source§

fnis_empty(&self) ->bool

🔬This is a nightly-only experimental API. (exact_size_is_empty #35428)
Returnstrue if the iterator is empty.Read more
Source§

impl<T>From<Range<T>> forRange<T>

Source§

fnfrom(value:Range<T>) ->Range<T>

Converts to this type from the input type.
Source§

impl<T>From<Range<T>> forRange<T>

Source§

fnfrom(value:Range<T>) ->Range<T>

Converts to this type from the input type.
Source§

implGetDisjointMutIndex forRange<usize>

Source§

fnis_in_bounds(&self, len:usize) ->bool

🔬This is a nightly-only experimental API. (get_disjoint_mut_helpers)
Returnstrue ifself is in bounds forlen slice elements.
Source§

fnis_overlapping(&self, other: &Range<usize>) ->bool

🔬This is a nightly-only experimental API. (get_disjoint_mut_helpers)
Returnstrue ifself overlaps withother.Read more
1.0.0 ·Source§

impl<Idx>Hash forRange<Idx>
where Idx:Hash,

Source§

fnhash<__H>(&self, state:&mut __H)
where __H:Hasher,

Feeds this value into the givenHasher.Read more
1.3.0 ·Source§

fnhash_slice<H>(data: &[Self], state:&mut H)
where H:Hasher, Self:Sized,

Feeds a slice of this type into the givenHasher.Read more
Source§

implIndex<Range<usize>> forByteString

Source§

typeOutput =ByteStr

The returned type after indexing.
Source§

fnindex(&self, r:Range<usize>) -> &ByteStr

Performs the indexing (container[index]) operation.Read more
Source§

implIndexMut<Range<usize>> forByteString

Source§

fnindex_mut(&mut self, r:Range<usize>) -> &mutByteStr

Performs the mutable indexing (container[index]) operation.Read more
Source§

impl<T>IntoBounds<T> forRange<T>

Source§

fninto_bounds(self) -> (Bound<T>,Bound<T>)

🔬This is a nightly-only experimental API. (range_into_bounds #136903)
Convert this range into the start and end bounds.Returns(start_bound, end_bound).Read more
Source§

fnintersect<R>(self, other: R) -> (Bound<T>,Bound<T>)
where Self:Sized, T:Ord, R:IntoBounds<T>,

🔬This is a nightly-only experimental API. (range_into_bounds #136903)
Compute the intersection ofself andother.Read more
1.0.0 ·Source§

impl<A>Iterator forRange<A>
where A:Step,

Source§

typeItem = A

The type of the elements being iterated over.
Source§

fnnext(&mut self) ->Option<A>

Advances the iterator and returns the next value.Read more
Source§

fnsize_hint(&self) -> (usize,Option<usize>)

Returns the bounds on the remaining length of the iterator.Read more
Source§

fncount(self) ->usize

Consumes the iterator, counting the number of iterations and returning it.Read more
Source§

fnnth(&mut self, n:usize) ->Option<A>

Returns thenth element of the iterator.Read more
Source§

fnlast(self) ->Option<A>

Consumes the iterator, returning the last element.Read more
Source§

fnmin(self) ->Option<A>
where A:Ord,

Returns the minimum element of an iterator.Read more
Source§

fnmax(self) ->Option<A>
where A:Ord,

Returns the maximum element of an iterator.Read more
Source§

fnis_sorted(self) ->bool

Checks if the elements of this iterator are sorted.Read more
Source§

fnadvance_by(&mut self, n:usize) ->Result<(),NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by #77404)
Advances the iterator byn elements.Read more
Source§

fnnext_chunk<const N:usize>( &mut self,) ->Result<[Self::Item;N],IntoIter<Self::Item, N>>
where Self:Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk #98326)
Advances the iterator and returns an array containing the nextN values.Read more
1.28.0 ·Source§

fnstep_by(self, step:usize) ->StepBy<Self>
where Self:Sized,

Creates an iterator starting at the same point, but stepping bythe given amount at each iteration.Read more
1.0.0 ·Source§

fnchain<U>(self, other: U) ->Chain<Self, <U asIntoIterator>::IntoIter>
where Self:Sized, U:IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence.Read more
1.0.0 ·Source§

fnzip<U>(self, other: U) ->Zip<Self, <U asIntoIterator>::IntoIter>
where Self:Sized, U:IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs.Read more
Source§

fnintersperse(self, separator: Self::Item) ->Intersperse<Self>
where Self:Sized, Self::Item:Clone,

🔬This is a nightly-only experimental API. (iter_intersperse #79524)
Creates a new iterator which places a copy ofseparator between adjacentitems of the original iterator.Read more
Source§

fnintersperse_with<G>(self, separator: G) ->IntersperseWith<Self, G>
where Self:Sized, G:FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse #79524)
Creates a new iterator which places an item generated byseparatorbetween adjacent items of the original iterator.Read more
1.0.0 ·Source§

fnmap<B, F>(self, f: F) ->Map<Self, F>
where Self:Sized, F:FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on eachelement.Read more
1.21.0 ·Source§

fnfor_each<F>(self, f: F)
where Self:Sized, F:FnMut(Self::Item),

Calls a closure on each element of an iterator.Read more
1.0.0 ·Source§

fnfilter<P>(self, predicate: P) ->Filter<Self, P>
where Self:Sized, P:FnMut(&Self::Item) ->bool,

Creates an iterator which uses a closure to determine if an elementshould be yielded.Read more
1.0.0 ·Source§

fnfilter_map<B, F>(self, f: F) ->FilterMap<Self, F>
where Self:Sized, F:FnMut(Self::Item) ->Option<B>,

Creates an iterator that both filters and maps.Read more
1.0.0 ·Source§

fnenumerate(self) ->Enumerate<Self>
where Self:Sized,

Creates an iterator which gives the current iteration count as well asthe next value.Read more
1.0.0 ·Source§

fnpeekable(self) ->Peekable<Self>
where Self:Sized,

Creates an iterator which can use thepeek andpeek_mut methodsto look at the next element of the iterator without consuming it. Seetheir documentation for more information.Read more
1.0.0 ·Source§

fnskip_while<P>(self, predicate: P) ->SkipWhile<Self, P>
where Self:Sized, P:FnMut(&Self::Item) ->bool,

Creates an iterator thatskips elements based on a predicate.Read more
1.0.0 ·Source§

fntake_while<P>(self, predicate: P) ->TakeWhile<Self, P>
where Self:Sized, P:FnMut(&Self::Item) ->bool,

Creates an iterator that yields elements based on a predicate.Read more
1.57.0 ·Source§

fnmap_while<B, P>(self, predicate: P) ->MapWhile<Self, P>
where Self:Sized, P:FnMut(Self::Item) ->Option<B>,

Creates an iterator that both yields elements based on a predicate and maps.Read more
1.0.0 ·Source§

fnskip(self, n:usize) ->Skip<Self>
where Self:Sized,

Creates an iterator that skips the firstn elements.Read more
1.0.0 ·Source§

fntake(self, n:usize) ->Take<Self>
where Self:Sized,

Creates an iterator that yields the firstn elements, or fewerif the underlying iterator ends sooner.Read more
1.0.0 ·Source§

fnscan<St, B, F>(self, initial_state: St, f: F) ->Scan<Self, St, F>
where Self:Sized, F:FnMut(&mut St, Self::Item) ->Option<B>,

An iterator adapter which, likefold, holds internal state, butunlikefold, produces a new iterator.Read more
1.0.0 ·Source§

fnflat_map<U, F>(self, f: F) ->FlatMap<Self, U, F>
where Self:Sized, U:IntoIterator, F:FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure.Read more
1.29.0 ·Source§

fnflatten(self) ->Flatten<Self>
where Self:Sized, Self::Item:IntoIterator,

Creates an iterator that flattens nested structure.Read more
Source§

fnmap_windows<F, R, const N:usize>(self, f: F) ->MapWindows<Self, F, N>
where Self:Sized, F:FnMut(&[Self::Item;N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows #87155)
Calls the given functionf for each contiguous window of sizeN overself and returns an iterator over the outputs off. Likeslice::windows(),the windows during mapping overlap as well.Read more
1.0.0 ·Source§

fnfuse(self) ->Fuse<Self>
where Self:Sized,

Creates an iterator which ends after the firstNone.Read more
1.0.0 ·Source§

fninspect<F>(self, f: F) ->Inspect<Self, F>
where Self:Sized, F:FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on.Read more
1.0.0 ·Source§

fnby_ref(&mut self) -> &mut Self
where Self:Sized,

Creates a “by reference” adapter for this instance ofIterator.Read more
1.0.0 ·Source§

fncollect<B>(self) -> B
where B:FromIterator<Self::Item>, Self:Sized,

Transforms an iterator into a collection.Read more
Source§

fntry_collect<B>( &mut self,) -> <<Self::Item asTry>::Residual asResidual<B>>::TryType
where Self:Sized, Self::Item:Try, <Self::Item asTry>::Residual:Residual<B>, B:FromIterator<<Self::Item asTry>::Output>,

🔬This is a nightly-only experimental API. (iterator_try_collect #94047)
Fallibly transforms an iterator into a collection, short circuiting ifa failure is encountered.Read more
Source§

fncollect_into<E>(self, collection:&mut E) ->&mut E
where E:Extend<Self::Item>, Self:Sized,

🔬This is a nightly-only experimental API. (iter_collect_into #94780)
Collects all the items from an iterator into a collection.Read more
1.0.0 ·Source§

fnpartition<B, F>(self, f: F) ->(B, B)
where Self:Sized, B:Default +Extend<Self::Item>, F:FnMut(&Self::Item) ->bool,

Consumes an iterator, creating two collections from it.Read more
Source§

fnpartition_in_place<'a, T, P>(self, predicate: P) ->usize
where T: 'a, Self:Sized +DoubleEndedIterator<Item =&'a mut T>, P:FnMut(&T) ->bool,

🔬This is a nightly-only experimental API. (iter_partition_in_place #62543)
Reorders the elements of this iteratorin-place according to the given predicate,such that all those that returntrue precede all those that returnfalse.Returns the number oftrue elements found.Read more
Source§

fnis_partitioned<P>(self, predicate: P) ->bool
where Self:Sized, P:FnMut(Self::Item) ->bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned #62544)
Checks if the elements of this iterator are partitioned according to the given predicate,such that all those that returntrue precede all those that returnfalse.Read more
1.27.0 ·Source§

fntry_fold<B, F, R>(&mut self, init: B, f: F) -> R
where Self:Sized, F:FnMut(B, Self::Item) -> R, R:Try<Output = B>,

An iterator method that applies a function as long as it returnssuccessfully, producing a single, final value.Read more
1.27.0 ·Source§

fntry_for_each<F, R>(&mut self, f: F) -> R
where Self:Sized, F:FnMut(Self::Item) -> R, R:Try<Output =()>,

An iterator method that applies a fallible function to each item in theiterator, stopping at the first error and returning that error.Read more
1.0.0 ·Source§

fnfold<B, F>(self, init: B, f: F) -> B
where Self:Sized, F:FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation,returning the final result.Read more
1.51.0 ·Source§

fnreduce<F>(self, f: F) ->Option<Self::Item>
where Self:Sized, F:FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducingoperation.Read more
Source§

fntry_reduce<R>( &mut self, f: implFnMut(Self::Item, Self::Item) -> R,) -> <<R asTry>::Residual asResidual<Option<<R asTry>::Output>>>::TryType
where Self:Sized, R:Try<Output = Self::Item>, <R asTry>::Residual:Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce #87053)
Reduces the elements to a single one by repeatedly applying a reducing operation. If theclosure returns a failure, the failure is propagated back to the caller immediately.Read more
1.0.0 ·Source§

fnall<F>(&mut self, f: F) ->bool
where Self:Sized, F:FnMut(Self::Item) ->bool,

Tests if every element of the iterator matches a predicate.Read more
1.0.0 ·Source§

fnany<F>(&mut self, f: F) ->bool
where Self:Sized, F:FnMut(Self::Item) ->bool,

Tests if any element of the iterator matches a predicate.Read more
1.0.0 ·Source§

fnfind<P>(&mut self, predicate: P) ->Option<Self::Item>
where Self:Sized, P:FnMut(&Self::Item) ->bool,

Searches for an element of an iterator that satisfies a predicate.Read more
1.30.0 ·Source§

fnfind_map<B, F>(&mut self, f: F) ->Option<B>
where Self:Sized, F:FnMut(Self::Item) ->Option<B>,

Applies function to the elements of iterator and returnsthe first non-none result.Read more
Source§

fntry_find<R>( &mut self, f: implFnMut(&Self::Item) -> R,) -> <<R asTry>::Residual asResidual<Option<Self::Item>>>::TryType
where Self:Sized, R:Try<Output =bool>, <R asTry>::Residual:Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find #63178)
Applies function to the elements of iterator and returnsthe first true result or the first error.Read more
1.0.0 ·Source§

fnposition<P>(&mut self, predicate: P) ->Option<usize>
where Self:Sized, P:FnMut(Self::Item) ->bool,

Searches for an element in an iterator, returning its index.Read more
1.0.0 ·Source§

fnrposition<P>(&mut self, predicate: P) ->Option<usize>

Searches for an element in an iterator from the right, returning itsindex.Read more
1.6.0 ·Source§

fnmax_by_key<B, F>(self, f: F) ->Option<Self::Item>
where B:Ord, Self:Sized, F:FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from thespecified function.Read more
1.15.0 ·Source§

fnmax_by<F>(self, compare: F) ->Option<Self::Item>
where Self:Sized, F:FnMut(&Self::Item, &Self::Item) ->Ordering,

Returns the element that gives the maximum value with respect to thespecified comparison function.Read more
1.6.0 ·Source§

fnmin_by_key<B, F>(self, f: F) ->Option<Self::Item>
where B:Ord, Self:Sized, F:FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from thespecified function.Read more
1.15.0 ·Source§

fnmin_by<F>(self, compare: F) ->Option<Self::Item>
where Self:Sized, F:FnMut(&Self::Item, &Self::Item) ->Ordering,

Returns the element that gives the minimum value with respect to thespecified comparison function.Read more
1.0.0 ·Source§

fnrev(self) ->Rev<Self>

Reverses an iterator’s direction.Read more
1.0.0 ·Source§

fnunzip<A, B, FromA, FromB>(self) ->(FromA, FromB)
where FromA:Default +Extend<A>, FromB:Default +Extend<B>, Self:Sized +Iterator<Item =(A, B)>,

Converts an iterator of pairs into a pair of containers.Read more
1.36.0 ·Source§

fncopied<'a, T>(self) ->Copied<Self>
where T:Copy + 'a, Self:Sized +Iterator<Item =&'a T>,

Creates an iterator which copies all of its elements.Read more
1.0.0 ·Source§

fncloned<'a, T>(self) ->Cloned<Self>
where T:Clone + 'a, Self:Sized +Iterator<Item =&'a T>,

Creates an iterator whichclones all of its elements.Read more
1.0.0 ·Source§

fncycle(self) ->Cycle<Self>
where Self:Sized +Clone,

Repeats an iterator endlessly.Read more
Source§

fnarray_chunks<const N:usize>(self) ->ArrayChunks<Self, N>
where Self:Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks #100450)
Returns an iterator overN elements of the iterator at a time.Read more
1.11.0 ·Source§

fnsum<S>(self) -> S
where Self:Sized, S:Sum<Self::Item>,

Sums the elements of an iterator.Read more
1.11.0 ·Source§

fnproduct<P>(self) -> P
where Self:Sized, P:Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elementsRead more
1.5.0 ·Source§

fncmp<I>(self, other: I) ->Ordering
where I:IntoIterator<Item = Self::Item>, Self::Item:Ord, Self:Sized,

Lexicographically compares the elements of thisIterator with thoseof another.Read more
Source§

fncmp_by<I, F>(self, other: I, cmp: F) ->Ordering
where Self:Sized, I:IntoIterator, F:FnMut(Self::Item, <I asIntoIterator>::Item) ->Ordering,

🔬This is a nightly-only experimental API. (iter_order_by #64295)
Lexicographically compares the elements of thisIterator with thoseof another with respect to the specified comparison function.Read more
1.5.0 ·Source§

fnpartial_cmp<I>(self, other: I) ->Option<Ordering>
where I:IntoIterator, Self::Item:PartialOrd<<I asIntoIterator>::Item>, Self:Sized,

Lexicographically compares thePartialOrd elements ofthisIterator with those of another. The comparison works like short-circuitevaluation, returning a result without comparing the remaining elements.As soon as an order can be determined, the evaluation stops and a result is returned.Read more
Source§

fnpartial_cmp_by<I, F>(self, other: I, partial_cmp: F) ->Option<Ordering>
where Self:Sized, I:IntoIterator, F:FnMut(Self::Item, <I asIntoIterator>::Item) ->Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by #64295)
Lexicographically compares the elements of thisIterator with thoseof another with respect to the specified comparison function.Read more
1.5.0 ·Source§

fneq<I>(self, other: I) ->bool
where I:IntoIterator, Self::Item:PartialEq<<I asIntoIterator>::Item>, Self:Sized,

Determines if the elements of thisIterator are equal to those ofanother.Read more
Source§

fneq_by<I, F>(self, other: I, eq: F) ->bool
where Self:Sized, I:IntoIterator, F:FnMut(Self::Item, <I asIntoIterator>::Item) ->bool,

🔬This is a nightly-only experimental API. (iter_order_by #64295)
Determines if the elements of thisIterator are equal to those ofanother with respect to the specified equality function.Read more
1.5.0 ·Source§

fnne<I>(self, other: I) ->bool
where I:IntoIterator, Self::Item:PartialEq<<I asIntoIterator>::Item>, Self:Sized,

Determines if the elements of thisIterator are not equal to those ofanother.Read more
1.5.0 ·Source§

fnlt<I>(self, other: I) ->bool
where I:IntoIterator, Self::Item:PartialOrd<<I asIntoIterator>::Item>, Self:Sized,

Determines if the elements of thisIterator arelexicographicallyless than those of another.Read more
1.5.0 ·Source§

fnle<I>(self, other: I) ->bool
where I:IntoIterator, Self::Item:PartialOrd<<I asIntoIterator>::Item>, Self:Sized,

Determines if the elements of thisIterator arelexicographicallyless or equal to those of another.Read more
1.5.0 ·Source§

fngt<I>(self, other: I) ->bool
where I:IntoIterator, Self::Item:PartialOrd<<I asIntoIterator>::Item>, Self:Sized,

Determines if the elements of thisIterator arelexicographicallygreater than those of another.Read more
1.5.0 ·Source§

fnge<I>(self, other: I) ->bool
where I:IntoIterator, Self::Item:PartialOrd<<I asIntoIterator>::Item>, Self:Sized,

Determines if the elements of thisIterator arelexicographicallygreater than or equal to those of another.Read more
1.82.0 ·Source§

fnis_sorted_by<F>(self, compare: F) ->bool
where Self:Sized, F:FnMut(&Self::Item, &Self::Item) ->bool,

Checks if the elements of this iterator are sorted using the given comparator function.Read more
1.82.0 ·Source§

fnis_sorted_by_key<F, K>(self, f: F) ->bool
where Self:Sized, F:FnMut(Self::Item) -> K, K:PartialOrd,

Checks if the elements of this iterator are sorted using the given key extractionfunction.Read more
1.0.0 (const:unstable) ·Source§

impl<Idx>PartialEq forRange<Idx>
where Idx:PartialEq,

Source§

fneq(&self, other: &Range<Idx>) ->bool

Tests forself andother values to be equal, and is used by==.
1.0.0 ·Source§

fnne(&self, other:&Rhs) ->bool

Tests for!=. The default implementation is almost always sufficient,and should not be overridden without very good reason.
1.28.0 (const: unstable) ·Source§

impl<T>RangeBounds<T> forRange<&T>

If you need to use this implementation whereT is unsized,consider using theRangeBounds impl for a 2-tuple ofBound<&T>,i.e. replacestart..end with(Bound::Included(start), Bound::Excluded(end)).

Source§

fnstart_bound(&self) ->Bound<&T>

Start index bound.Read more
Source§

fnend_bound(&self) ->Bound<&T>

End index bound.Read more
1.35.0 ·Source§

fncontains<U>(&self, item:&U) ->bool
where T:PartialOrd<U>, U:PartialOrd<T> + ?Sized,

Returnstrue ifitem is contained in the range.Read more
Source§

fnis_empty(&self) ->bool
where T:PartialOrd,

🔬This is a nightly-only experimental API. (range_bounds_is_empty #137300)
Returnstrue if the range contains no items.One-sided ranges (RangeFrom, etc) always returnfalse.Read more
1.28.0 (const: unstable) ·Source§

impl<T>RangeBounds<T> forRange<T>

Source§

fnstart_bound(&self) ->Bound<&T>

Start index bound.Read more
Source§

fnend_bound(&self) ->Bound<&T>

End index bound.Read more
1.35.0 ·Source§

fncontains<U>(&self, item:&U) ->bool
where T:PartialOrd<U>, U:PartialOrd<T> + ?Sized,

Returnstrue ifitem is contained in the range.Read more
Source§

fnis_empty(&self) ->bool
where T:PartialOrd,

🔬This is a nightly-only experimental API. (range_bounds_is_empty #137300)
Returnstrue if the range contains no items.One-sided ranges (RangeFrom, etc) always returnfalse.Read more
1.15.0 (const:unstable) ·Source§

impl<T>SliceIndex<[T]> forRange<usize>

The methodsindex andindex_mut panic if:

  • the start of the range is greater than the end of the range or
  • the end of the range is out of bounds.
Source§

typeOutput =[T]

The output type returned by methods.
Source§

fnget(self, slice: &[T]) ->Option<&[T]>

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if inbounds.
Source§

fnget_mut(self, slice: &mut[T]) ->Option<&mut[T]>

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if inbounds.
Source§

unsafe fnget_unchecked(self, slice:*const[T]) ->*const[T]

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, withoutperforming any bounds checking.Read more
Source§

unsafe fnget_unchecked_mut(self, slice:*mut[T]) ->*mut[T]

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, withoutperforming any bounds checking.Read more
Source§

fnindex(self, slice: &[T]) -> &[T]

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panickingif out of bounds.
Source§

fnindex_mut(self, slice: &mut[T]) -> &mut[T]

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panickingif out of bounds.
Source§

implSliceIndex<ByteStr> forRange<usize>

Source§

typeOutput =ByteStr

The output type returned by methods.
Source§

fnget( self, slice: &ByteStr,) ->Option<&<Range<usize> asSliceIndex<ByteStr>>::Output>

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if inbounds.
Source§

fnget_mut( self, slice: &mutByteStr,) ->Option<&mut <Range<usize> asSliceIndex<ByteStr>>::Output>

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if inbounds.
Source§

unsafe fnget_unchecked( self, slice:*constByteStr,) ->*const<Range<usize> asSliceIndex<ByteStr>>::Output

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, withoutperforming any bounds checking.Read more
Source§

unsafe fnget_unchecked_mut( self, slice:*mutByteStr,) ->*mut<Range<usize> asSliceIndex<ByteStr>>::Output

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, withoutperforming any bounds checking.Read more
Source§

fnindex( self, slice: &ByteStr,) -> &<Range<usize> asSliceIndex<ByteStr>>::Output

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panickingif out of bounds.
Source§

fnindex_mut( self, slice: &mutByteStr,) -> &mut <Range<usize> asSliceIndex<ByteStr>>::Output

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panickingif out of bounds.
1.20.0 (const:unstable) ·Source§

implSliceIndex<str> forRange<usize>

Implements substring slicing with syntax&self[begin .. end] or&mut self[begin .. end].

Returns a slice of the given string from the byte range[begin,end).

This operation isO(1).

Prior to 1.20.0, these indexing operations were still supported bydirect implementation ofIndex andIndexMut.

§Panics

Panics ifbegin orend does not point to the starting byte offset ofa character (as defined byis_char_boundary), ifbegin > end, or ifend > len.

§Examples

lets ="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];
Source§

typeOutput =str

The output type returned by methods.
Source§

fnget(self, slice: &str) ->Option<&<Range<usize> asSliceIndex<str>>::Output>

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if inbounds.
Source§

fnget_mut( self, slice: &mutstr,) ->Option<&mut <Range<usize> asSliceIndex<str>>::Output>

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if inbounds.
Source§

unsafe fnget_unchecked( self, slice:*conststr,) ->*const<Range<usize> asSliceIndex<str>>::Output

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, withoutperforming any bounds checking.Read more
Source§

unsafe fnget_unchecked_mut( self, slice:*mutstr,) ->*mut<Range<usize> asSliceIndex<str>>::Output

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, withoutperforming any bounds checking.Read more
Source§

fnindex(self, slice: &str) -> &<Range<usize> asSliceIndex<str>>::Output

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panickingif out of bounds.
Source§

fnindex_mut( self, slice: &mutstr,) -> &mut <Range<usize> asSliceIndex<str>>::Output

🔬This is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panickingif out of bounds.
Source§

impl<T>CloneFromCell forRange<T>
where T:CloneFromCell,

1.0.0 ·Source§

impl<Idx>Eq forRange<Idx>
where Idx:Eq,

1.26.0 ·Source§

impl<A>FusedIterator forRange<A>
where A:Step,

1.0.0 ·Source§

impl<Idx>StructuralPartialEq forRange<Idx>

Source§

impl<A>TrustedLen forRange<A>
where A:TrustedStep,

Auto Trait Implementations§

§

impl<Idx>Freeze forRange<Idx>
where Idx:Freeze,

§

impl<Idx>RefUnwindSafe forRange<Idx>
where Idx:RefUnwindSafe,

§

impl<Idx>Send forRange<Idx>
where Idx:Send,

§

impl<Idx>Sync forRange<Idx>
where Idx:Sync,

§

impl<Idx>Unpin forRange<Idx>
where Idx:Unpin,

§

impl<Idx>UnwindSafe forRange<Idx>
where Idx:UnwindSafe,

Blanket Implementations§

Source§

impl<T>Any for T
where T: 'static + ?Sized,

Source§

fntype_id(&self) ->TypeId

Gets theTypeId ofself.Read more
Source§

impl<T>Borrow<T> for T
where T: ?Sized,

Source§

fnborrow(&self) ->&T

Immutably borrows from an owned value.Read more
Source§

impl<T>BorrowMut<T> for T
where T: ?Sized,

Source§

fnborrow_mut(&mut self) ->&mut T

Mutably borrows from an owned value.Read more
Source§

impl<T>CloneToUninit for T
where T:Clone,

Source§

unsafe fnclone_to_uninit(&self, dest:*mutu8)

🔬This is a nightly-only experimental API. (clone_to_uninit #126799)
Performs copy-assignment fromself todest.Read more
Source§

impl<T>From<T> for T

Source§

fnfrom(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U>Into<U> for T
where U:From<T>,

Source§

fninto(self) -> U

CallsU::from(self).

That is, this conversion is whatever the implementation ofFrom<T> for U chooses to do.

Source§

impl<I>IntoIterator for I
where I:Iterator,

Source§

typeItem = <I asIterator>::Item

The type of the elements being iterated over.
Source§

typeIntoIter = I

Which kind of iterator are we turning this into?
Source§

fninto_iter(self) -> I

Creates an iterator from a value.Read more
Source§

impl<T>ToOwned for T
where T:Clone,

Source§

typeOwned = T

The resulting type after obtaining ownership.
Source§

fnto_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning.Read more
Source§

fnclone_into(&self, target:&mut T)

Uses borrowed data to replace owned data, usually by cloning.Read more
Source§

impl<T, U>TryFrom<U> for T
where U:Into<T>,

Source§

typeError =Infallible

The type returned in the event of a conversion error.
Source§

fntry_from(value: U) ->Result<T, <T asTryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U>TryInto<U> for T
where U:TryFrom<T>,

Source§

typeError = <U asTryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fntry_into(self) ->Result<U, <U asTryFrom<T>>::Error>

Performs the conversion.

[8]ページ先頭

©2009-2026 Movatter.jp