Skip to main content

Signed

Trait Signed 

Source
pub trait Signed:
    Div<NonZero<Self>, Output = CtOption<Self>>
    + for<'a> Div<&'a NonZero<Self>, Output = CtOption<Self>>
    + From<i8>
    + From<i16>
    + From<i32>
    + From<i64>
    + Gcd<Output = Self::Unsigned>
    + Integer {
    type Unsigned: Unsigned;

    // Required methods
    fn abs_sign(&self) -> (Self::Unsigned, Choice);
    fn is_negative(&self) -> Choice;
    fn is_positive(&self) -> Choice;

    // Provided method
    fn abs(&self) -> Self::Unsigned { ... }
}
Expand description

Signed Integers.

Required Associated Types§

Source

type Unsigned: Unsigned

Corresponding unsigned integer type.

Required Methods§

Source

fn abs_sign(&self) -> (Self::Unsigned, Choice)

The sign and magnitude of this Signed.

Source

fn is_negative(&self) -> Choice

Whether this Signed is negative (and non-zero), as a Choice.

Source

fn is_positive(&self) -> Choice

Whether this Signed is positive (and non-zero), as a Choice.

Provided Methods§

Source

fn abs(&self) -> Self::Unsigned

The magnitude of this Signed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<const LIMBS: usize> Signed for Int<LIMBS>

Source§

type Unsigned = Uint<LIMBS>