Trait snarkvm_wasm::Integer[][src]

pub trait Integer: Debug + Clone {
    type IntegerType;

    const SIZE: usize;

    fn constant(value: Self::IntegerType) -> Self;
fn one() -> Self;
fn zero() -> Self;
fn new(bits: Vec<Boolean, Global>, value: Option<Self::IntegerType>) -> Self;
fn is_constant(&self) -> bool;
fn to_bits_le(&self) -> Vec<Boolean, Global>;
fn from_bits_le(bits: &[Boolean]) -> Self;
fn get_value(&self) -> Option<String>; fn result_is_constant(first: &Self, second: &Self) -> bool { ... } }
Expand description

The interface for a singed or unsigned integer gadget.

Associated Types

Associated Constants

Required methods

fn constant(value: Self::IntegerType) -> Self[src]

fn one() -> Self[src]

fn zero() -> Self[src]

fn new(bits: Vec<Boolean, Global>, value: Option<Self::IntegerType>) -> Self[src]

fn is_constant(&self) -> bool[src]

Returns true if all bits in this Int are constant

fn to_bits_le(&self) -> Vec<Boolean, Global>[src]

fn from_bits_le(bits: &[Boolean]) -> Self[src]

fn get_value(&self) -> Option<String>[src]

Provided methods

fn result_is_constant(first: &Self, second: &Self) -> bool[src]

Returns true if both Int objects have constant bits

Implementors

impl Integer for Int8[src]

type IntegerType = i8

pub const SIZE: usize[src]

pub fn constant(value: i8) -> Int8[src]

pub fn one() -> Int8[src]

pub fn zero() -> Int8[src]

pub fn new(
    bits: Vec<Boolean, Global>,
    value: Option<<Int8 as Integer>::IntegerType>
) -> Int8
[src]

pub fn is_constant(&self) -> bool[src]

pub fn to_bits_le(&self) -> Vec<Boolean, Global>[src]

pub fn from_bits_le(bits: &[Boolean]) -> Int8[src]

pub fn get_value(&self) -> Option<String>[src]

impl Integer for Int16[src]

type IntegerType = i16

pub const SIZE: usize[src]

pub fn constant(value: i16) -> Int16[src]

pub fn one() -> Int16[src]

pub fn zero() -> Int16[src]

pub fn new(
    bits: Vec<Boolean, Global>,
    value: Option<<Int16 as Integer>::IntegerType>
) -> Int16
[src]

pub fn is_constant(&self) -> bool[src]

pub fn to_bits_le(&self) -> Vec<Boolean, Global>[src]

pub fn from_bits_le(bits: &[Boolean]) -> Int16[src]

pub fn get_value(&self) -> Option<String>[src]

impl Integer for Int32[src]

type IntegerType = i32

pub const SIZE: usize[src]

pub fn constant(value: i32) -> Int32[src]

pub fn one() -> Int32[src]

pub fn zero() -> Int32[src]

pub fn new(
    bits: Vec<Boolean, Global>,
    value: Option<<Int32 as Integer>::IntegerType>
) -> Int32
[src]

pub fn is_constant(&self) -> bool[src]

pub fn to_bits_le(&self) -> Vec<Boolean, Global>[src]

pub fn from_bits_le(bits: &[Boolean]) -> Int32[src]

pub fn get_value(&self) -> Option<String>[src]

impl Integer for Int64[src]

type IntegerType = i64

pub const SIZE: usize[src]

pub fn constant(value: i64) -> Int64[src]

pub fn one() -> Int64[src]

pub fn zero() -> Int64[src]

pub fn new(
    bits: Vec<Boolean, Global>,
    value: Option<<Int64 as Integer>::IntegerType>
) -> Int64
[src]

pub fn is_constant(&self) -> bool[src]

pub fn to_bits_le(&self) -> Vec<Boolean, Global>[src]

pub fn from_bits_le(bits: &[Boolean]) -> Int64[src]

pub fn get_value(&self) -> Option<String>[src]

impl Integer for Int128[src]

type IntegerType = i128

pub const SIZE: usize[src]

pub fn constant(value: i128) -> Int128[src]

pub fn one() -> Int128[src]

pub fn zero() -> Int128[src]

pub fn new(
    bits: Vec<Boolean, Global>,
    value: Option<<Int128 as Integer>::IntegerType>
) -> Int128
[src]

pub fn is_constant(&self) -> bool[src]

pub fn to_bits_le(&self) -> Vec<Boolean, Global>[src]

pub fn from_bits_le(bits: &[Boolean]) -> Int128[src]

pub fn get_value(&self) -> Option<String>[src]

impl Integer for UInt8[src]

type IntegerType = u8

pub const SIZE: usize[src]

pub fn constant(value: u8) -> UInt8[src]

pub fn one() -> UInt8[src]

pub fn zero() -> UInt8[src]

pub fn new(
    bits: Vec<Boolean, Global>,
    value: Option<<UInt8 as Integer>::IntegerType>
) -> UInt8
[src]

pub fn is_constant(&self) -> bool[src]

pub fn to_bits_le(&self) -> Vec<Boolean, Global>[src]

pub fn from_bits_le(bits: &[Boolean]) -> UInt8[src]

pub fn get_value(&self) -> Option<String>[src]

impl Integer for UInt16[src]

type IntegerType = u16

pub const SIZE: usize[src]

pub fn constant(value: u16) -> UInt16[src]

pub fn one() -> UInt16[src]

pub fn zero() -> UInt16[src]

pub fn new(
    bits: Vec<Boolean, Global>,
    value: Option<<UInt16 as Integer>::IntegerType>
) -> UInt16
[src]

pub fn is_constant(&self) -> bool[src]

pub fn to_bits_le(&self) -> Vec<Boolean, Global>[src]

pub fn from_bits_le(bits: &[Boolean]) -> UInt16[src]

pub fn get_value(&self) -> Option<String>[src]

impl Integer for UInt32[src]

type IntegerType = u32

pub const SIZE: usize[src]

pub fn constant(value: u32) -> UInt32[src]

pub fn one() -> UInt32[src]

pub fn zero() -> UInt32[src]

pub fn new(
    bits: Vec<Boolean, Global>,
    value: Option<<UInt32 as Integer>::IntegerType>
) -> UInt32
[src]

pub fn is_constant(&self) -> bool[src]

pub fn to_bits_le(&self) -> Vec<Boolean, Global>[src]

pub fn from_bits_le(bits: &[Boolean]) -> UInt32[src]

pub fn get_value(&self) -> Option<String>[src]

impl Integer for UInt64[src]

type IntegerType = u64

pub const SIZE: usize[src]

pub fn constant(value: u64) -> UInt64[src]

pub fn one() -> UInt64[src]

pub fn zero() -> UInt64[src]

pub fn new(
    bits: Vec<Boolean, Global>,
    value: Option<<UInt64 as Integer>::IntegerType>
) -> UInt64
[src]

pub fn is_constant(&self) -> bool[src]

pub fn to_bits_le(&self) -> Vec<Boolean, Global>[src]

pub fn from_bits_le(bits: &[Boolean]) -> UInt64[src]

pub fn get_value(&self) -> Option<String>[src]

impl Integer for UInt128[src]

type IntegerType = u128

pub const SIZE: usize[src]

pub fn constant(value: u128) -> UInt128[src]

pub fn one() -> UInt128[src]

pub fn zero() -> UInt128[src]

pub fn new(
    bits: Vec<Boolean, Global>,
    value: Option<<UInt128 as Integer>::IntegerType>
) -> UInt128
[src]

pub fn is_constant(&self) -> bool[src]

pub fn to_bits_le(&self) -> Vec<Boolean, Global>[src]

pub fn from_bits_le(bits: &[Boolean]) -> UInt128[src]

pub fn get_value(&self) -> Option<String>[src]