pub struct Ranged<TRange>(_)
where
TRange: IRange;Implementations
sourceimpl<TRange> Ranged<TRange> where
TRange: IRange + IRangeFrom + IRangeToInclusive,
ErrInt: From<TRange::ValueType>,
impl<TRange> Ranged<TRange> where
TRange: IRange + IRangeFrom + IRangeToInclusive,
ErrInt: From<TRange::ValueType>,
sourcepub const fn from(value: TRange::ValueType) -> Self where
TRange: IRange + IRangeFrom + IRangeTo,
pub const fn from(value: TRange::ValueType) -> Self where
TRange: IRange + IRangeFrom + IRangeTo,
Constructor
This constructor is intended to be called from const context. This way, if the value passed in is
out of bounds, the compilation will fail. If the code runs, it means the value passed in was within
bounds and therefore the function signature is infallible (at runtime). NOTE: Rust does not provide
a way to only provide a (const) method at compile-time, thus, this function can also be called
with a runtime value. In such a case, it will panic if the provided value is out of bounds. When writing
panic-free code, use the try_from() constructor instead.
Returns
Self, if value is within TRange’s range bounds.
Panics
If value is not within TRange’s range bounds:
* fails to compile if value is const (or a literal), or
* panics at runtime if value is not const (prefer try_from() constructor instead).
sourcepub const fn try_from(value: TRange::ValueType) -> Result<Self> where
TRange: IRange + IRangeFrom + IRangeTo,
pub const fn try_from(value: TRange::ValueType) -> Result<Self> where
TRange: IRange + IRangeFrom + IRangeTo,
sourcepub const unsafe fn unchecked_from(value: TRange::ValueType) -> Self
pub const unsafe fn unchecked_from(value: TRange::ValueType) -> Self
Constructor
For orthogonality with this type’s other constructors, this constructor may be called from const context.
Returns
Self, unconditionally.
Safety
This constructor is unsafe because the value being passed in is not verified to be within the bounds of
TRange. It is the caller’s responsibility to ensure that this contract is upheld–violating it is Undefined
Behavior.
Trait Implementations
sourceimpl<TRange: Default> Default for Ranged<TRange> where
TRange: IRange,
TRange::ValueType: Default,
impl<TRange: Default> Default for Ranged<TRange> where
TRange: IRange,
TRange::ValueType: Default,
sourceimpl<TRange> IMinMax<Ranged<TRange>> for Ranged<TRange> where
Self: PartialOrd,
TRange: IRangeFrom + IRangeTo + IRangeToInclusive,
impl<TRange> IMinMax<Ranged<TRange>> for Ranged<TRange> where
Self: PartialOrd,
TRange: IRangeFrom + IRangeTo + IRangeToInclusive,
sourceimpl<TRangeLhs> IUnaryWrappingOps for Ranged<TRangeLhs> where
Self: PartialOrd,
TRangeLhs: Clone + IMinMax<TRangeLhs::ValueType> + IRangeFrom + IRangeToInclusive,
TRangeLhs::ValueType: PartialOrd + IWrappingOps,
<TRangeLhs as IRange>::WidenedValueType: IWrappingOps<Output = <TRangeLhs as IRange>::WidenedValueType> + Clone + NumOps<<TRangeLhs as IRange>::WidenedValueType, <TRangeLhs as IRange>::WidenedValueType> + One + PartialOrd + Zero,
impl<TRangeLhs> IUnaryWrappingOps for Ranged<TRangeLhs> where
Self: PartialOrd,
TRangeLhs: Clone + IMinMax<TRangeLhs::ValueType> + IRangeFrom + IRangeToInclusive,
TRangeLhs::ValueType: PartialOrd + IWrappingOps,
<TRangeLhs as IRange>::WidenedValueType: IWrappingOps<Output = <TRangeLhs as IRange>::WidenedValueType> + Clone + NumOps<<TRangeLhs as IRange>::WidenedValueType, <TRangeLhs as IRange>::WidenedValueType> + One + PartialOrd + Zero,
type Output = Ranged<TRangeLhs>
fn wrapping_abs(self) -> Self::Output
fn wrapping_neg(self) -> Self::Output
fn wrapping_pow(self, _rhs: u32) -> Self::Output
fn wrapping_shl(self, _rhs: u32) -> Self::Output
fn wrapping_shr(self, _rhs: u32) -> Self::Output
sourceimpl<TRangeLhs, TRangeRhs> IWrappingOps<Ranged<TRangeRhs>> for Ranged<TRangeLhs> where
ErrInt: From<TRangeLhs::ValueType>,
Self: PartialOrd,
TRangeLhs: Clone + IMinMax<TRangeLhs::ValueType> + IRangeFrom + IRangeToInclusive + PartialOrd,
TRangeLhs::ValueType: Debug + PartialOrd + IWrappingOps,
TRangeLhs::WidenedValueType: Add<TRangeRhs::WidenedValueType, Output = TRangeLhs::WidenedValueType> + Clone + Debug + Div<Output = TRangeLhs::WidenedValueType> + IWrappingOps<Output = <TRangeLhs as IRange>::WidenedValueType> + NumOps<<TRangeLhs as IRange>::WidenedValueType, <TRangeLhs as IRange>::WidenedValueType> + One + PartialOrd + Sub<TRangeRhs::WidenedValueType, Output = TRangeLhs::WidenedValueType> + Zero,
TRangeRhs: IRangeFrom + IRangeToInclusive,
impl<TRangeLhs, TRangeRhs> IWrappingOps<Ranged<TRangeRhs>> for Ranged<TRangeLhs> where
ErrInt: From<TRangeLhs::ValueType>,
Self: PartialOrd,
TRangeLhs: Clone + IMinMax<TRangeLhs::ValueType> + IRangeFrom + IRangeToInclusive + PartialOrd,
TRangeLhs::ValueType: Debug + PartialOrd + IWrappingOps,
TRangeLhs::WidenedValueType: Add<TRangeRhs::WidenedValueType, Output = TRangeLhs::WidenedValueType> + Clone + Debug + Div<Output = TRangeLhs::WidenedValueType> + IWrappingOps<Output = <TRangeLhs as IRange>::WidenedValueType> + NumOps<<TRangeLhs as IRange>::WidenedValueType, <TRangeLhs as IRange>::WidenedValueType> + One + PartialOrd + Sub<TRangeRhs::WidenedValueType, Output = TRangeLhs::WidenedValueType> + Zero,
TRangeRhs: IRangeFrom + IRangeToInclusive,
fn wrapping_add(self, rhs: Ranged<TRangeRhs>) -> Self::Output
fn wrapping_div(self, _rhs: Ranged<TRangeRhs>) -> Self::Output
fn wrapping_div_euclid(self, _rhs: Ranged<TRangeRhs>) -> Self::Output
fn wrapping_mul(self, _rhs: Ranged<TRangeRhs>) -> Self::Output
fn wrapping_rem(self, _rhs: Ranged<TRangeRhs>) -> Self::Output
fn wrapping_rem_euclid(self, _rhs: Ranged<TRangeRhs>) -> Self::Output
fn wrapping_sub(self, rhs: Ranged<TRangeRhs>) -> Self::Output
sourceimpl<TRange: Ord> Ord for Ranged<TRange> where
TRange: IRange,
TRange::ValueType: Ord,
impl<TRange: Ord> Ord for Ranged<TRange> where
TRange: IRange,
TRange::ValueType: Ord,
sourceimpl<TRange: PartialEq> PartialEq<Ranged<TRange>> for Ranged<TRange> where
TRange: IRange,
TRange::ValueType: PartialEq,
impl<TRange: PartialEq> PartialEq<Ranged<TRange>> for Ranged<TRange> where
TRange: IRange,
TRange::ValueType: PartialEq,
sourceimpl<TRange: PartialOrd> PartialOrd<Ranged<TRange>> for Ranged<TRange> where
TRange: IRange,
TRange::ValueType: PartialOrd,
impl<TRange: PartialOrd> PartialOrd<Ranged<TRange>> for Ranged<TRange> where
TRange: IRange,
TRange::ValueType: PartialOrd,
sourcefn partial_cmp(&self, other: &Ranged<TRange>) -> Option<Ordering>
fn partial_cmp(&self, other: &Ranged<TRange>) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl<TRange: Copy> Copy for Ranged<TRange> where
TRange: IRange,
TRange::ValueType: Copy,
impl<TRange: Eq> Eq for Ranged<TRange> where
TRange: IRange,
TRange::ValueType: Eq,
impl<TRange> StructuralEq for Ranged<TRange> where
TRange: IRange,
impl<TRange> StructuralPartialEq for Ranged<TRange> where
TRange: IRange,
Auto Trait Implementations
impl<TRange> RefUnwindSafe for Ranged<TRange> where
<TRange as IRange>::ValueType: RefUnwindSafe,
impl<TRange> Send for Ranged<TRange> where
<TRange as IRange>::ValueType: Send,
impl<TRange> Sync for Ranged<TRange> where
<TRange as IRange>::ValueType: Sync,
impl<TRange> Unpin for Ranged<TRange> where
<TRange as IRange>::ValueType: Unpin,
impl<TRange> UnwindSafe for Ranged<TRange> where
<TRange as IRange>::ValueType: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more