hacspec_lib::prelude

Struct u64Word

Source
pub struct u64Word(pub [u8; 8]);
Expand description

Fixed length byte array.

Tuple Fields§

§0: [u8; 8]

Implementations§

Source§

impl u64Word

Source

pub fn new() -> Self

Source

pub fn length() -> usize

Source

pub fn from_array(v: [u8; 8]) -> Self

Source

pub fn from_native_slice(v: &[u8]) -> Self

Source§

impl u64Word

Source

pub fn from_slice<A: SeqTrait<u8>>(input: &A, start: usize, len: usize) -> Self

Source

pub fn concat<A: SeqTrait<u8>>(&self, next: &A) -> Seq<u8>

Source

pub fn from_slice_range<A: SeqTrait<u8>>(input: &A, r: Range<usize>) -> Self

Source

pub fn slice(&self, start_out: usize, len: usize) -> Seq<u8>

Source

pub fn slice_range(&self, r: Range<usize>) -> Seq<u8>

Source

pub fn num_chunks(&self, chunk_size: usize) -> usize

Source

pub fn get_chunk_len(&self, chunk_size: usize, chunk_number: usize) -> usize

Source

pub fn get_chunk( &self, chunk_size: usize, chunk_number: usize, ) -> (usize, Seq<u8>)

Source

pub fn set_chunk<A: SeqTrait<u8>>( self, chunk_size: usize, chunk_number: usize, input: &A, ) -> Self

Source§

impl u64Word

Source

pub fn from_vec(x: Vec<u8>) -> u64Word

Source

pub fn from_seq<T: SeqTrait<u8>>(x: &T) -> u64Word

Source§

impl u64Word

Source

pub fn from_hex(s: &str) -> u64Word

Read hex string to Bytes.

Source§

impl u64Word

Source

pub fn into_le_bytes(self) -> Seq<u8>

Source§

impl u64Word

Source

pub fn to_be_u32s(&self) -> Seq<u32>

Source

pub fn to_le_u32s(&self) -> Seq<u32>

Source

pub fn to_be_u64s(&self) -> Seq<u64>

Source

pub fn to_le_u64s(&self) -> Seq<u64>

Source

pub fn to_u128s_be(&self) -> Seq<u128>

Source

pub fn to_u128s_le(&self) -> Seq<u128>

Source

pub fn to_hex(&self) -> String

Trait Implementations§

Source§

impl Add for u64Word

Warning: wraps on overflow.

Source§

type Output = u64Word

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u64Word) -> u64Word

Performs the + operation. Read more
Source§

impl BitAnd for u64Word

Bit-wise and operation on the coefficients.

Source§

type Output = u64Word

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

impl BitOr for u64Word

Bit-wise or operation on the coefficients.

Source§

type Output = u64Word

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl BitXor for u64Word

Bit-wise xor operation on the coefficients.

Source§

type Output = u64Word

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

impl Clone for u64Word

Source§

fn clone(&self) -> u64Word

Returns a copy 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 u64Word

Source§

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

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

impl Default for u64Word

Source§

fn default() -> Self

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

impl Div for u64Word

Warning: panics on division by 0.

Source§

type Output = u64Word

The resulting type after applying the / operator.
Source§

fn div(self, rhs: u64Word) -> u64Word

Performs the / operation. Read more
Source§

impl Index<RangeFull> for u64Word

Source§

type Output = [u8]

The returned type after indexing.
Source§

fn index(&self, r: RangeFull) -> &[u8]

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

impl Index<i32> for u64Word

Source§

type Output = u8

The returned type after indexing.
Source§

fn index(&self, i: i32) -> &u8

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

impl Index<u32> for u64Word

Source§

type Output = u8

The returned type after indexing.
Source§

fn index(&self, i: u32) -> &u8

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

impl Index<u8> for u64Word

Source§

type Output = u8

The returned type after indexing.
Source§

fn index(&self, i: u8) -> &u8

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

impl Index<usize> for u64Word

Source§

type Output = u8

The returned type after indexing.
Source§

fn index(&self, i: usize) -> &u8

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

impl IndexMut<i32> for u64Word

Source§

fn index_mut(&mut self, i: i32) -> &mut u8

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

impl IndexMut<u32> for u64Word

Source§

fn index_mut(&mut self, i: u32) -> &mut u8

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

impl IndexMut<u8> for u64Word

Source§

fn index_mut(&mut self, i: u8) -> &mut u8

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

impl IndexMut<usize> for u64Word

Source§

fn index_mut(&mut self, i: usize) -> &mut u8

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

impl ModNumeric for u64Word

Source§

fn sub_mod(self, rhs: Self, n: Self) -> Self

(self - rhs) % n (coefficient-wise)

Source§

fn add_mod(self, rhs: Self, n: Self) -> Self

(self + rhs) % n (coefficient-wise)

Source§

fn mul_mod(self, rhs: Self, n: Self) -> Self

(self * rhs) % n (coefficient-wise) Note that the multiplication is wrapping.

Source§

fn pow_mod(self, exp: Self, n: Self) -> Self

(self ^ exp) % n (coefficient-wise) Note that the exponentiation is wrapping.

Source§

fn modulo(self, n: Self) -> Self

self % n (coefficient-wise)

Source§

fn signed_modulo(self, n: Self) -> Self

self % n (coefficient-wise)

Source§

fn absolute(self) -> Self

|self| (coefficient-wise)

Source§

impl Mul for u64Word

Warning: wraps on overflow.

Source§

type Output = u64Word

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u64Word) -> u64Word

Performs the * operation. Read more
Source§

impl Not for u64Word

Bit-wise not operation on the coefficients.

Source§

type Output = u64Word

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl Numeric for u64Word

Source§

fn max_val() -> Self

Return largest value that can be represented. Not Implemented

Source§

fn wrap_add(self, rhs: Self) -> Self

self + rhs (coefficient-wise and wrapping)

Source§

fn wrap_sub(self, rhs: Self) -> Self

self - rhs (coefficient-wise and wrapping)

Source§

fn wrap_mul(self, rhs: Self) -> Self

self * rhs (coefficient-wise and wrapping)

Source§

fn wrap_div(self, rhs: Self) -> Self

self + rhs (coefficient-wise and wrapping)

Source§

fn exp(self, exp: u32) -> Self

self ^ exp where exp is a u32 (coefficient-wise and wrapping).

Source§

fn pow_self(self, _exp: Self) -> Self

Not implemented.

Source§

fn divide(self, rhs: Self) -> Self

self / rhs (coefficient-wise and wrapping).

Source§

fn inv(self, _n: Self) -> Self

Not implemented

Source§

fn equal(self, _other: Self) -> bool

Source§

fn greater_than(self, _other: Self) -> bool

Source§

fn greater_than_or_equal(self, _other: Self) -> bool

Source§

fn less_than(self, _other: Self) -> bool

Source§

fn less_than_or_equal(self, _other: Self) -> bool

Source§

fn not_equal_bm(self, _other: Self) -> Self

Source§

fn equal_bm(self, _other: Self) -> Self

Source§

fn greater_than_bm(self, _other: Self) -> Self

Source§

fn greater_than_or_equal_bm(self, _other: Self) -> Self

Source§

fn less_than_bm(self, _other: Self) -> Self

Source§

fn less_than_or_equal_bm(self, _other: Self) -> Self

Source§

impl Ord for u64Word

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for u64Word

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 PartialOrd for u64Word

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl SeqTrait<u8> for u64Word

Source§

fn create(x: usize) -> Self

Source§

fn len(&self) -> usize

Source§

fn iter(&self) -> Iter<'_, u8>

Source§

fn update_slice<A: SeqTrait<u8>>( self, start_out: usize, v: &A, start_in: usize, len: usize, ) -> Self

Update this sequence with l elements of v, starting at start_in, at start_out. Read more
Source§

fn update<A: SeqTrait<u8>>(self, start: usize, v: &A) -> Self

Update this sequence with v starting at start. Read more
Source§

fn update_start<A: SeqTrait<u8>>(self, v: &A) -> Self

Source§

impl Shl<usize> for u64Word

Unimplemented

Source§

type Output = u64Word

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

fn shl(self, _rhs: usize) -> Self::Output

Performs the << operation. Read more
Source§

impl Shr<usize> for u64Word

Unimplemented

Source§

type Output = u64Word

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

fn shr(self, _rhs: usize) -> Self::Output

Performs the >> operation. Read more
Source§

impl Sub for u64Word

Warning: wraps on underflow.

Source§

type Output = u64Word

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u64Word) -> u64Word

Performs the - operation. Read more
Source§

impl Copy for u64Word

Source§

impl Eq for u64Word

Source§

impl NumericCopy for u64Word

Auto Trait Implementations§

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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, 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.