Struct otter_api_tests::imports::digest::generic_array::typenum::UInt [−]
pub struct UInt<U, B> { /* fields omitted */ }
Expand description
UInt
is defined recursively, where B
is the least significant bit and U
is the rest
of the number. Conceptually, U
should be bound by the trait Unsigned
and B
should
be bound by the trait Bit
, but enforcing these bounds causes linear instead of
logrithmic scaling in some places, so they are left off for now. They may be enforced in
future.
In order to keep numbers unique, leading zeros are not allowed, so UInt<UTerm, B0>
is
forbidden.
Example
use typenum::{UInt, UTerm, B0, B1}; type U6 = UInt<UInt<UInt<UTerm, B1>, B1>, B0>;
Implementations
Trait Implementations
U + B0 = U
UInt<U, B0> + B1 = UInt<U + B1>
UInt<U, B1> + B1 = UInt<U + B1, B0>
UInt<Ul, B1> + UInt<Ur, B0> = UInt<Ul + Ur, B1>
UInt<Ul, B0> + UInt<Ur, B0> = UInt<Ul + Ur, B0>
UInt<Ul, B0> + UInt<Ur, B1> = UInt<Ul + Ur, B1>
UInt<Ul, B1> + UInt<Ur, B1> = UInt<(Ul + Ur) + B1, B0>
UInt<U, B> + UTerm = UInt<U, B>
impl<T, N> ArrayLength<T> for UInt<N, B1> where
N: ArrayLength<T>,
impl<T, N> ArrayLength<T> for UInt<N, B1> where
N: ArrayLength<T>,
type ArrayType
type ArrayType
Associated type representing the array type for the number
impl<T, N> ArrayLength<T> for UInt<N, B0> where
N: ArrayLength<T>,
impl<T, N> ArrayLength<T> for UInt<N, B0> where
N: ArrayLength<T>,
type ArrayType
type ArrayType
Associated type representing the array type for the number
Anding unsigned integers.
We use our PrivateAnd
operator and then Trim
the output.
UInt<Ul, B1> | UInt<Ur, B0> = UInt<Ul | Ur, B1>
UInt<Ul, B0> | UInt<Ur, B0> = UInt<Ul | Ur, B0>
UInt<Ul, B1> | UInt<Ur, B1> = UInt<Ul | Ur, B1>
UInt<Ul, B0> | UInt<Ur, B1> = UInt<Ul | Ur, B1>
X | UTerm = X
Xoring unsigned integers.
We use our PrivateXor
operator and then Trim
the output.
Zero < Nonzero
UInt<Ul, B1>
cmp with UInt<Ur, B0>
: SoFar
is Greater
UInt<Ul, B0>
cmp with UInt<Ur, B0>
: SoFar
is Equal
UInt<Ul, B1>
cmp with UInt<Ur, B1>
: SoFar
is Equal
UInt<Ul, B0>
cmp with UInt<Ur, B1>
: SoFar
is Less
Nonzero > Zero
The resulting type after applying the /
operator.
gcd(x, y) = 2*gcd(x/2, y/2) if both x and y even
gcd(x, y) = gcd(x, y/2) if x odd and y even
gcd(x, y) = gcd(x/2, y) if x even and y odd
impl<Xp, Yp> Gcd<UInt<Yp, B1>> for UInt<Xp, B1> where
UInt<Xp, B1>: Max<UInt<Yp, B1>>,
UInt<Xp, B1>: Min<UInt<Yp, B1>>,
UInt<Yp, B1>: Max<UInt<Xp, B1>>,
UInt<Yp, B1>: Min<UInt<Xp, B1>>,
<UInt<Xp, B1> as Max<UInt<Yp, B1>>>::Output: Sub<<UInt<Xp, B1> as Min<UInt<Yp, B1>>>::Output>,
<<UInt<Xp, B1> as Max<UInt<Yp, B1>>>::Output as Sub<<UInt<Xp, B1> as Min<UInt<Yp, B1>>>::Output>>::Output: Gcd<<UInt<Xp, B1> as Min<UInt<Yp, B1>>>::Output>,
impl<Xp, Yp> Gcd<UInt<Yp, B1>> for UInt<Xp, B1> where
UInt<Xp, B1>: Max<UInt<Yp, B1>>,
UInt<Xp, B1>: Min<UInt<Yp, B1>>,
UInt<Yp, B1>: Max<UInt<Xp, B1>>,
UInt<Yp, B1>: Min<UInt<Xp, B1>>,
<UInt<Xp, B1> as Max<UInt<Yp, B1>>>::Output: Sub<<UInt<Xp, B1> as Min<UInt<Yp, B1>>>::Output>,
<<UInt<Xp, B1> as Max<UInt<Yp, B1>>>::Output as Sub<<UInt<Xp, B1> as Min<UInt<Yp, B1>>>::Output>>::Output: Gcd<<UInt<Xp, B1> as Min<UInt<Yp, B1>>>::Output>,
gcd(x, y) = gcd([max(x, y) - min(x, y)], min(x, y)) if both x and y odd
This will immediately invoke the case for x even and y odd because the difference of two odd numbers is an even number.
Length of a bit is 1
UInt * B0 = UTerm
UInt * B1 = UInt
UInt<Ul, B0> * UInt<Ur, B> = UInt<(Ul * UInt<Ur, B>), B0>
UInt<Ul, B1> * UInt<Ur, B> = UInt<(Ul * UInt<Ur, B>), B0> + UInt<Ur, B>
UInt<U, B> * UTerm = UTerm
impl<Ur, Br> PartialDiv<UInt<Ur, Br>> for UTerm where
Ur: Unsigned,
Br: Bit,
impl<Ur, Br> PartialDiv<UInt<Ur, Br>> for UTerm where
Ur: Unsigned,
Br: Bit,
pub fn partial_div(
self,
UInt<Ur, Br>
) -> <UTerm as PartialDiv<UInt<Ur, Br>>>::Output
pub fn partial_div(
self,
UInt<Ur, Br>
) -> <UTerm as PartialDiv<UInt<Ur, Br>>>::Output
Method for performing the division
impl<U, B> PartialOrd<UInt<U, B>> for UInt<U, B> where
U: PartialOrd<U>,
B: PartialOrd<B>,
impl<U, B> PartialOrd<UInt<U, B>> for UInt<U, B> where
U: PartialOrd<U>,
B: PartialOrd<B>,
pub fn partial_cmp(&self, other: &UInt<U, B>) -> Option<Ordering>
pub fn partial_cmp(&self, other: &UInt<U, B>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
The resulting type after applying the %
operator.
Shifting left any unsigned by a zero bit: U << B0 = U
Shifting left a UInt
by a one bit: UInt<U, B> << B1 = UInt<UInt<U, B>, B0>
Shifting left UInt
by UInt
: X << Y
= UInt(X, B0) << (Y - 1)
Shifting left UInt
by UTerm
: UInt<U, B> << UTerm = UInt<U, B>
Shifting right any unsigned by a zero bit: U >> B0 = U
Shifting right a UInt
by a 1 bit: UInt<U, B> >> B1 = U
Shifting right UInt
by UInt
: UInt(U, B) >> Y
= U >> (Y - 1)
Shifting right UInt
by UTerm
: UInt<U, B> >> UTerm = UInt<U, B>
UInt - B0 = UInt
UInt<U, B1> - B1 = UInt<U, B0>
UInt<U, B0> - B1 = UInt<U - B1, B1>
UInt<UTerm, B1> - B1 = UTerm
Subtracting unsigned integers. We just do our PrivateSub
and then Trim
the output.
impl PowerOfTwo for UInt<UTerm, B1>
impl<U> PowerOfTwo for UInt<U, B0> where
U: Unsigned + PowerOfTwo,
impl<U, B> StructuralEq for UInt<U, B>
impl<U, B> StructuralPartialEq for UInt<U, B>
Auto Trait Implementations
impl<U, B> RefUnwindSafe for UInt<U, B> where
B: RefUnwindSafe,
U: RefUnwindSafe,
impl<U, B> UnwindSafe for UInt<U, B> where
B: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<R, Global>
impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
A: Allocator,
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
A: Allocator + 'static,
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<R, Global>
impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
A: Allocator,
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
A: Allocator + 'static,
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
impl<A> DynCastExt for A
impl<A> DynCastExt for A
pub fn dyn_cast<T>(
self
) -> Result<<A as DynCastExtHelper<T>>::Target, <A as DynCastExtHelper<T>>::Source> where
T: ?Sized,
A: DynCastExtHelper<T>,
pub fn dyn_cast<T>(
self
) -> Result<<A as DynCastExtHelper<T>>::Target, <A as DynCastExtHelper<T>>::Source> where
T: ?Sized,
A: DynCastExtHelper<T>,
Use this to cast from one trait object type to another. Read more
pub fn dyn_upcast<T>(self) -> <A as DynCastExtAdvHelper<T, T>>::Target where
T: ?Sized,
A: DynCastExtAdvHelper<T, T, Source = <A as DynCastExtAdvHelper<T, T>>::Target>,
pub fn dyn_upcast<T>(self) -> <A as DynCastExtAdvHelper<T, T>>::Target where
T: ?Sized,
A: DynCastExtAdvHelper<T, T, Source = <A as DynCastExtAdvHelper<T, T>>::Target>,
Use this to upcast a trait to one of its supertraits. Read more
pub fn dyn_cast_adv<F, T>(
self
) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source> where
T: ?Sized,
A: DynCastExtAdvHelper<F, T>,
F: ?Sized,
pub fn dyn_cast_adv<F, T>(
self
) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source> where
T: ?Sized,
A: DynCastExtAdvHelper<F, T>,
F: ?Sized,
pub fn dyn_cast_with_config<C>(
self
) -> Result<<A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Target, <A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Source> where
C: DynCastConfig,
A: DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>,
pub fn dyn_cast_with_config<C>(
self
) -> Result<<A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Target, <A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Source> where
C: DynCastConfig,
A: DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>,
Use this to cast from one trait object type to another. With this method the type parameter is a config type that uniquely specifies which cast should be preformed. Read more
Compare self to key
and return true
if they are equal.
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]impl<N> Logarithm2 for N where
N: PrivateLogarithm2,
impl<N> Logarithm2 for N where
N: PrivateLogarithm2,
type Output = <N as PrivateLogarithm2>::Output
type Output = <N as PrivateLogarithm2>::Output
The result of the integer binary logarithm.
impl<N, I, B> SetBit<I, B> for N where
N: PrivateSetBit<I, B>,
<N as PrivateSetBit<I, B>>::Output: Trim,
impl<N, I, B> SetBit<I, B> for N where
N: PrivateSetBit<I, B>,
<N as PrivateSetBit<I, B>>::Output: Trim,
impl<N> SquareRoot for N where
N: PrivateSquareRoot,
impl<N> SquareRoot for N where
N: PrivateSquareRoot,
type Output = <N as PrivateSquareRoot>::Output
type Output = <N as PrivateSquareRoot>::Output
The result of the integer square root.
pub fn vzip(self) -> V