Skip to main content

IdxRangeBounds

Trait IdxRangeBounds 

Source
pub trait IdxRangeBounds<I>: Sealed
where I: Idx,
{ type Range: RangeBounds<usize>; // Required method fn into_range(self) -> Self::Range; }
Expand description

This trait to function in API signatures where Vec<T> or [T] use R: RangeBounds<usize>. There are blanket implementations for the basic range types in core::ops for all Idx types. e.g. Range<I: Idx>, RangeFrom<I: Idx>, RangeTo<I: Idx>, etc all implement it.

IMO it’s unfortunate that this needs to be present in the API, but it doesn’t hurt that much.

Required Associated Types§

Required Methods§

Source

fn into_range(self) -> Self::Range

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§