wasmtime_environ

Trait Signed

pub trait Signed {
    type Signed;

    // Required method
    fn signed(self) -> Self::Signed;
}
Expand description

Helper trait used to add signed() methods to primitive unsigned integer types.

The purpose of this trait is to signal the intent that the sign bit of an unsigned integer is intended to be discarded and the value is instead understood to be a “bag of bits” where the conversion to a signed number is intended to be lossless bit-wise. This can be used for example when converting an unsigned integer into a signed integer for constrained reasons outside the scope of the code in question.

Required Associated Types§

type Signed

The signed integer for this type which has the same width.

Required Methods§

fn signed(self) -> Self::Signed

View this unsigned integer as a signed integer of the same width.

All bits are preserved.

Implementations on Foreign Types§

§

impl Signed for u8

§

type Signed = i8

§

fn signed(self) -> i8

§

impl Signed for u16

§

type Signed = i16

§

fn signed(self) -> i16

§

impl Signed for u32

§

type Signed = i32

§

fn signed(self) -> i32

§

impl Signed for u64

§

type Signed = i64

§

fn signed(self) -> i64

§

impl Signed for u128

§

type Signed = i128

§

fn signed(self) -> i128

§

impl Signed for usize

§

type Signed = isize

§

fn signed(self) -> isize

Implementors§