Value

Struct Value 

Source
pub struct Value {
    pub len: u16,
    pub bytes: [u8; 1024],
}
Expand description

Copy’able variable length slice

Fields§

§len: u16

Slice length

§bytes: [u8; 1024]

Slice bytes

Implementations§

Source§

impl Value

Source

pub fn step_op(arithm: Arithmetics, step: i8) -> impl Fn(Value) -> Option<Value>

Source

pub fn add_op(arithm: Arithmetics) -> fn(Value, Value) -> Option<Value>

Source

pub fn sub_op(arithm: Arithmetics) -> fn(Value, Value) -> Option<Value>

Source

pub fn mul_op(arithm: Arithmetics) -> fn(Value, Value) -> Option<Value>

Source

pub fn div_op(arithm: Arithmetics) -> fn(Value, Value) -> Option<Value>

Source

pub fn rem_op(arithm: Arithmetics) -> fn(Value, Value) -> Option<Value>

Source§

impl Value

Source

pub fn cmp(self, num_type: NumType, other: Self) -> Ordering

Compares two values according to given arithmetics

Source

pub fn cmp_uint(self, other: Self) -> Ordering

Compares two values according to unsigned arithmetics

Source

pub fn cmp_int(self, other: Self) -> Ordering

Compares two values according to unsigned arithmetics

Source

pub fn cmp_f23(self, other: Self) -> Ordering

Compares two values according to short float arithmetics

Source

pub fn cmp_f52(self, other: Self) -> Ordering

Compares two values according to long float arithmetics

Source§

impl Value

Source

pub fn step_uint_checked(value: Value, step: i8) -> Option<Value>

Source

pub fn step_uint_unchecked(value: Value, step: i8) -> Option<Value>

Source

pub fn step_uint_ap(src: Value, step: i8) -> Option<Value>

Source

pub fn step_int_checked(src: Value, step: i8) -> Option<Value>

Source

pub fn step_int_unchecked(src: Value, step: i8) -> Option<Value>

Source

pub fn step_int_ap(src: Value, step: i8) -> Option<Value>

Source

pub fn step_float(src: Value, step: i8) -> Option<Value>

Source

pub fn step_float_ap(src: Value, step: i8) -> Option<Value>

Source§

impl Value

Source

pub fn add_uint_checked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn add_uint_unchecked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn add_uint_ap(src1: Value, src2: Value) -> Option<Value>

Source

pub fn add_int_checked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn add_int_unchecked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn add_int_ap(src1: Value, src2: Value) -> Option<Value>

Source

pub fn add_float(src1: Value, src2: Value) -> Option<Value>

Source

pub fn add_float_ap(src1: Value, src2: Value) -> Option<Value>

Source§

impl Value

Source

pub fn sub_uint_checked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn sub_uint_unchecked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn sub_uint_ap(src1: Value, src2: Value) -> Option<Value>

Source

pub fn sub_int_checked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn sub_int_unchecked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn sub_int_ap(src1: Value, src2: Value) -> Option<Value>

Source

pub fn sub_float(src1: Value, src2: Value) -> Option<Value>

Source

pub fn sub_float_ap(src1: Value, src2: Value) -> Option<Value>

Source§

impl Value

Source

pub fn mul_uint_checked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn mul_uint_unchecked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn mul_uint_ap(src1: Value, src2: Value) -> Option<Value>

Source

pub fn mul_int_checked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn mul_int_unchecked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn mul_int_ap(src1: Value, src2: Value) -> Option<Value>

Source

pub fn mul_float(src1: Value, src2: Value) -> Option<Value>

Source

pub fn mul_float_ap(src1: Value, src2: Value) -> Option<Value>

Source§

impl Value

Source

pub fn div_uint_checked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn div_uint_unchecked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn div_uint_ap(src1: Value, src2: Value) -> Option<Value>

Source

pub fn div_int_checked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn div_int_unchecked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn div_int_ap(src1: Value, src2: Value) -> Option<Value>

Source

pub fn div_float(src1: Value, src2: Value) -> Option<Value>

Source

pub fn div_float_ap(src1: Value, src2: Value) -> Option<Value>

Source§

impl Value

Source

pub fn rem_uint_checked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn rem_uint_unchecked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn rem_uint_ap(src1: Value, src2: Value) -> Option<Value>

Source

pub fn rem_int_checked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn rem_int_unchecked(src1: Value, src2: Value) -> Option<Value>

Source

pub fn rem_int_ap(src1: Value, src2: Value) -> Option<Value>

Source

pub fn rem_float(src1: Value, src2: Value) -> Option<Value>

Source

pub fn rem_float_ap(src1: Value, src2: Value) -> Option<Value>

Source§

impl Value

Source

pub fn scl(src1: Value, src2: Value) -> Value

Source

pub fn scr(src1: Value, src2: Value) -> Value

Source§

impl Value

Source

pub fn zero(len: u16) -> Value

Creates zero value of a given dimension

Source

pub fn with(slice: impl AsRef<[u8]>) -> Value

Constructs value from slice of bytes.

Panics if the length of the slice is greater than 1024 bytes.

Source

pub fn count_ones(&self) -> u16

Returns the number of ones in the binary representation of self.

Source

pub fn clean(&mut self)

Ensures that all non-value bits are set to zero

Source

pub fn to_clean(self) -> Self

Returns a copy where all non-value bits are set to zero

Source

pub fn to_u1024(self) -> u1024

Converts the value into u1024 integer

Trait Implementations§

Source§

impl AsMut<[u8]> for Value

Source§

fn as_mut(&mut self) -> &mut [u8]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<[u8]> for Value

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl BitAnd for Value

Source§

type Output = Value

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl BitOr for Value

Source§

type Output = Value

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl BitXor for Value

Source§

type Output = Value

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: Self) -> Self::Output

Performs the ^ operation. Read more
Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Value

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Value

Source§

fn default() -> Value

Returns the “default value” for a type. Read more
Source§

impl Display for Value

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&Value> for RegVal

Source§

fn from(val: &Value) -> Self

Converts to this type from the input type.
Source§

impl From<&i128> for Value

Source§

fn from(val: &i128) -> Self

Converts to this type from the input type.
Source§

impl From<&i16> for Value

Source§

fn from(val: &i16) -> Self

Converts to this type from the input type.
Source§

impl From<&i32> for Value

Source§

fn from(val: &i32) -> Self

Converts to this type from the input type.
Source§

impl From<&i64> for Value

Source§

fn from(val: &i64) -> Self

Converts to this type from the input type.
Source§

impl From<&i8> for Value

Source§

fn from(val: &i8) -> Self

Converts to this type from the input type.
Source§

impl From<&u1024> for Value

Source§

fn from(val: &u1024) -> Self

Converts to this type from the input type.
Source§

impl From<&u128> for Value

Source§

fn from(val: &u128) -> Self

Converts to this type from the input type.
Source§

impl From<&u16> for Value

Source§

fn from(val: &u16) -> Self

Converts to this type from the input type.
Source§

impl From<&u256> for Value

Source§

fn from(val: &u256) -> Self

Converts to this type from the input type.
Source§

impl From<&u32> for Value

Source§

fn from(val: &u32) -> Self

Converts to this type from the input type.
Source§

impl From<&u512> for Value

Source§

fn from(val: &u512) -> Self

Converts to this type from the input type.
Source§

impl From<&u64> for Value

Source§

fn from(val: &u64) -> Self

Converts to this type from the input type.
Source§

impl From<&u8> for Value

Source§

fn from(val: &u8) -> Self

Converts to this type from the input type.
Source§

impl From<[u8; 1]> for Value

Source§

fn from(val: [u8; 1]) -> Value

Converts to this type from the input type.
Source§

impl From<[u8; 1024]> for Value

Source§

fn from(val: [u8; 1024]) -> Value

Converts to this type from the input type.
Source§

impl From<[u8; 128]> for Value

Source§

fn from(val: [u8; 128]) -> Value

Converts to this type from the input type.
Source§

impl From<[u8; 16]> for Value

Source§

fn from(val: [u8; 16]) -> Value

Converts to this type from the input type.
Source§

impl From<[u8; 2]> for Value

Source§

fn from(val: [u8; 2]) -> Value

Converts to this type from the input type.
Source§

impl From<[u8; 20]> for Value

Source§

fn from(val: [u8; 20]) -> Value

Converts to this type from the input type.
Source§

impl From<[u8; 256]> for Value

Source§

fn from(val: [u8; 256]) -> Value

Converts to this type from the input type.
Source§

impl From<[u8; 32]> for Value

Source§

fn from(val: [u8; 32]) -> Value

Converts to this type from the input type.
Source§

impl From<[u8; 4]> for Value

Source§

fn from(val: [u8; 4]) -> Value

Converts to this type from the input type.
Source§

impl From<[u8; 512]> for Value

Source§

fn from(val: [u8; 512]) -> Value

Converts to this type from the input type.
Source§

impl From<[u8; 64]> for Value

Source§

fn from(val: [u8; 64]) -> Value

Converts to this type from the input type.
Source§

impl From<[u8; 8]> for Value

Source§

fn from(val: [u8; 8]) -> Value

Converts to this type from the input type.
Source§

impl From<Value> for [u8; 1]

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for [u8; 1024]

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for [u8; 128]

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for [u8; 16]

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for [u8; 2]

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for [u8; 20]

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for [u8; 256]

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for [u8; 32]

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for [u8; 4]

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for [u8; 512]

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for [u8; 64]

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for [u8; 8]

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for RegVal

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for i128

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for i16

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for i32

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for i64

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for i8

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for u1024

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for u128

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for u16

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for u256

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for u32

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for u512

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for u64

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for u8

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for Value

Source§

fn from(val: i128) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Value

Source§

fn from(val: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Value

Source§

fn from(val: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Value

Source§

fn from(val: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Value

Source§

fn from(val: i8) -> Self

Converts to this type from the input type.
Source§

impl From<u1024> for Value

Source§

fn from(val: u1024) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for Value

Source§

fn from(val: u128) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Value

Source§

fn from(val: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u256> for Value

Source§

fn from(val: u256) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Value

Source§

fn from(val: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u512> for Value

Source§

fn from(val: u512) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Value

Source§

fn from(val: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Value

Source§

fn from(val: u8) -> Self

Converts to this type from the input type.
Source§

impl Hash for Value

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Index<u16> for Value

Source§

type Output = u8

The returned type after indexing.
Source§

fn index(&self, index: u16) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl IndexMut<u16> for Value

Source§

fn index_mut(&mut self, index: u16) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl Not for Value

Source§

type Output = Value

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl PartialEq for Value

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Shl for Value

Source§

type Output = Value

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: Self) -> Self::Output

Performs the << operation. Read more
Source§

impl Shr for Value

Source§

type Output = Value

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: Self) -> Self::Output

Performs the >> operation. Read more
Source§

impl Copy for Value

Source§

impl Eq for Value

Auto Trait Implementations§

§

impl Freeze for Value

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnwindSafe for Value

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.