Trait bitstream_io::SignedNumeric [−][src]
pub trait SignedNumeric: Numeric { fn is_negative(self) -> bool; fn as_negative(self, bits: u32) -> Self; fn as_unsigned(self, bits: u32) -> Self; }
This trait extends many common signed integer types so that they can be used with the bitstream handling traits.
Required Methods
fn is_negative(self) -> bool
Returns true if this value is negative
fn as_negative(self, bits: u32) -> Self
Given a two-complement positive value and certain number of bits, returns this value as a negative number.
fn as_unsigned(self, bits: u32) -> Self
Given a negative value and a certain number of bits, returns this value as a twos-complement positive number.
Implementations on Foreign Types
impl SignedNumeric for i8
[src]
impl SignedNumeric for i8
fn is_negative(self) -> bool
[src]
fn is_negative(self) -> bool
fn as_negative(self, bits: u32) -> Self
[src]
fn as_negative(self, bits: u32) -> Self
fn as_unsigned(self, bits: u32) -> Self
[src]
fn as_unsigned(self, bits: u32) -> Self
impl SignedNumeric for i16
[src]
impl SignedNumeric for i16
fn is_negative(self) -> bool
[src]
fn is_negative(self) -> bool
fn as_negative(self, bits: u32) -> Self
[src]
fn as_negative(self, bits: u32) -> Self
fn as_unsigned(self, bits: u32) -> Self
[src]
fn as_unsigned(self, bits: u32) -> Self
impl SignedNumeric for i32
[src]
impl SignedNumeric for i32
fn is_negative(self) -> bool
[src]
fn is_negative(self) -> bool
fn as_negative(self, bits: u32) -> Self
[src]
fn as_negative(self, bits: u32) -> Self
fn as_unsigned(self, bits: u32) -> Self
[src]
fn as_unsigned(self, bits: u32) -> Self
impl SignedNumeric for i64
[src]
impl SignedNumeric for i64
fn is_negative(self) -> bool
[src]
fn is_negative(self) -> bool
fn as_negative(self, bits: u32) -> Self
[src]
fn as_negative(self, bits: u32) -> Self
fn as_unsigned(self, bits: u32) -> Self
[src]
fn as_unsigned(self, bits: u32) -> Self
impl SignedNumeric for i128
[src]
impl SignedNumeric for i128
fn is_negative(self) -> bool
[src]
fn is_negative(self) -> bool
fn as_negative(self, bits: u32) -> Self
[src]
fn as_negative(self, bits: u32) -> Self
fn as_unsigned(self, bits: u32) -> Self
[src]
fn as_unsigned(self, bits: u32) -> Self