Trait Signed

Source
pub trait Signed:
    Sized
    + Copy
    + Neg<Output = Self>
    + Shr<u32, Output = Self>
    + Shl<u32, Output = Self>
    + BitXor<Self, Output = Self> {
    type Unsigned: Unsigned;

    const BITS: u32;

    // Required method
    fn unsigned(self) -> Self::Unsigned;
}
Expand description

Trait that encodes common behaviors of signed numbers.

Required Associated Constants§

Source

const BITS: u32

The number of bits in this signed number.

Required Associated Types§

Source

type Unsigned: Unsigned

The unsigned representation of this number.

Required Methods§

Source

fn unsigned(self) -> Self::Unsigned

Coerce this number bitwise into its unsigned representation.

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.

Implementations on Foreign Types§

Source§

impl Signed for i16

Source§

const BITS: u32 = 16u32

Source§

type Unsigned = u16

Source§

fn unsigned(self) -> Self::Unsigned

Source§

impl Signed for i32

Source§

const BITS: u32 = 32u32

Source§

type Unsigned = u32

Source§

fn unsigned(self) -> Self::Unsigned

Source§

impl Signed for i64

Source§

const BITS: u32 = 64u32

Source§

type Unsigned = u64

Source§

fn unsigned(self) -> Self::Unsigned

Source§

impl Signed for i128

Source§

const BITS: u32 = 128u32

Source§

type Unsigned = u128

Source§

fn unsigned(self) -> Self::Unsigned

Source§

impl Signed for isize

Source§

const BITS: u32 = 64u32

Source§

type Unsigned = usize

Source§

fn unsigned(self) -> Self::Unsigned

Implementors§