[][src]Trait bitstream_io::SignedNumeric

pub trait SignedNumeric: Numeric {
    pub fn is_negative(self) -> bool;
pub fn as_negative(self, bits: u32) -> Self;
pub fn as_unsigned(self, bits: u32) -> Self;
pub fn signed_value(self) -> SignedValue; }

This trait extends many common signed integer types so that they can be used with the bitstream handling traits.

Required methods

pub fn is_negative(self) -> bool[src]

Returns true if this value is negative

pub fn as_negative(self, bits: u32) -> Self[src]

Given a two-complement positive value and certain number of bits, returns this value as a negative number.

pub fn as_unsigned(self, bits: u32) -> Self[src]

Given a negative value and a certain number of bits, returns this value as a twos-complement positive number.

pub fn signed_value(self) -> SignedValue[src]

Converts to a generic signed value for stream recording purposes.

Loading content...

Implementations on Foreign Types

impl SignedNumeric for i8[src]

impl SignedNumeric for i16[src]

impl SignedNumeric for i32[src]

impl SignedNumeric for i64[src]

impl SignedNumeric for i128[src]

Loading content...

Implementors

Loading content...