hacspec_lib::seq

Struct PublicSeq

Source
pub struct PublicSeq<T: Default + PublicInteger> { /* private fields */ }
Expand description

Variable length byte arrays.

Implementations§

Source§

impl PublicSeq<u8>

Source

pub fn from_public_slice(v: &[u8]) -> PublicSeq<u8>

Source

pub fn from_native(b: Vec<u8>) -> PublicSeq<u8>

Source

pub fn to_native(&self) -> Vec<u8>

Source

pub fn into_native(self) -> Vec<u8>

Source

pub fn as_slice(&self) -> &[u8]

Source§

impl<T: Clone + Default + PublicInteger> PublicSeq<T>

Source

pub fn new(l: usize) -> Self

Source

pub fn with_capacity(l: usize) -> Self

Source

pub fn reserve(self, additional: usize) -> Self

Source

pub fn len(&self) -> usize

Get the size of this sequence.

Source

pub fn slice(&self, start_out: usize, len: usize) -> Self

Source

pub fn native_slice(&self) -> &[T]

Source

pub fn into_slice(self, start_out: usize, len: usize) -> Self

Source

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

Source

pub fn into_slice_range(self, r: Range<usize>) -> Self

Source

pub fn split_off(self, at: usize) -> (Self, Self)

Source

pub fn pop(self) -> (T, Self)

Source

pub fn truncate(self, len: usize) -> Self

Source

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

Source

pub fn concat<A: SeqTrait<T>>(&self, next: &A) -> Self

Source

pub fn concat_owned(self, next: Self) -> Self

Source

pub fn push(&self, next: &T) -> Self

Source

pub fn push_owned(self, next: T) -> Self

Source

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

Source

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

Source

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

Get the number of chunks of chunk_size in this array. There might be less than chunk_size remaining elements in this array beyond these.

Source

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

Source

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

Get the chunk_number chunk of chunk_size from this array as Seq<T>. The resulting sequence is of exactly chunk_size length. Until #84 is fixed this returns an empty sequence if not enough elements are left.

Source

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

Get the remaining chunk of this array of length less than chunk_size. If there’s no remainder, i.e. if the length of this array can be divided by chunk_size without a remainder, the function returns an empty sequence (until #84 is fixed).

Source

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

Source

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

Source

pub fn update_owned(self, start_out: usize, v: Self) -> Self

Source§

impl<T: Clone + Default + PublicInteger> PublicSeq<T>

Source

pub fn from_vec(b: Vec<T>) -> PublicSeq<T>

Source

pub fn from_native_slice(x: &[T]) -> PublicSeq<T>

Source

pub fn from_seq<U: SeqTrait<T>>(x: &U) -> PublicSeq<T>

Source§

impl PublicSeq<u8>

Source§

impl PublicSeq<u8>

Source

pub fn to_hex(&self) -> String

Trait Implementations§

Source§

impl<T: Numeric + PublicInteger + Copy> Add for PublicSeq<T>

Polynomial addition on ℤ[x]

Source§

type Output = PublicSeq<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T: Numeric + PublicInteger + Copy> BitAnd for PublicSeq<T>

Source§

type Output = PublicSeq<T>

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

impl<T: Numeric + PublicInteger + Copy> BitOr for PublicSeq<T>

Source§

type Output = PublicSeq<T>

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl<T: Numeric + PublicInteger + Copy> BitXor for PublicSeq<T>

Source§

type Output = PublicSeq<T>

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

impl<T: Clone + Default + PublicInteger> Clone for PublicSeq<T>

Source§

fn clone(&self) -> PublicSeq<T>

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<T: Debug + Default + PublicInteger> Debug for PublicSeq<T>

Source§

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

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

impl<T: Default + Default + PublicInteger> Default for PublicSeq<T>

Source§

fn default() -> PublicSeq<T>

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

impl<T: Clone + Default + PublicInteger> Index<Range<usize>> for PublicSeq<T>

Source§

type Output = [T]

The returned type after indexing.
Source§

fn index(&self, r: Range<usize>) -> &[T]

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

impl<T: Clone + Default + PublicInteger> Index<i32> for PublicSeq<T>

Source§

type Output = T

The returned type after indexing.
Source§

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

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

impl<T: Clone + Default + PublicInteger> Index<u32> for PublicSeq<T>

Source§

type Output = T

The returned type after indexing.
Source§

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

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

impl<T: Clone + Default + PublicInteger> Index<u8> for PublicSeq<T>

Source§

type Output = T

The returned type after indexing.
Source§

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

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

impl<T: Clone + Default + PublicInteger> Index<usize> for PublicSeq<T>

Source§

type Output = T

The returned type after indexing.
Source§

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

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

impl<T: Clone + Default + PublicInteger> IndexMut<i32> for PublicSeq<T>

Source§

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

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

impl<T: Clone + Default + PublicInteger> IndexMut<u32> for PublicSeq<T>

Source§

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

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

impl<T: Clone + Default + PublicInteger> IndexMut<u8> for PublicSeq<T>

Source§

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

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

impl<T: Clone + Default + PublicInteger> IndexMut<usize> for PublicSeq<T>

Source§

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

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

impl<T: Numeric + PublicInteger + Copy> ModNumeric for PublicSeq<T>

Source§

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

(self - rhs) % n.

Source§

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

(self + rhs) % n

Source§

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

(self * rhs) % n

Source§

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

(self ^ exp) % n

Source§

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

self % n

Source§

fn absolute(self) -> Self

|self| (coefficient-wise)

Source§

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

self % n that always returns a positive integer
Source§

impl<T: Numeric + PublicInteger + Copy> Mul for PublicSeq<T>

Polynomial multiplication on ℤ[x]

Source§

type Output = PublicSeq<T>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<T: Numeric + PublicInteger + Copy> Not for PublicSeq<T>

Source§

type Output = PublicSeq<T>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<T: Numeric + PublicInteger + Copy> Numeric for PublicSeq<T>

Source§

fn max_val() -> Self

Return largest value that can be represented.

Source§

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

self ^ exp where exp is a u32.

Source§

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

self ^ exp where exp is a Self.

Source§

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

Division.

Source§

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

Invert self modulo n.

Source§

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

Source§

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

Source§

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

Source§

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

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<T: Copy + Default + PartialEq + PublicInteger> PartialEq for PublicSeq<T>

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<T: Clone + Default + PublicInteger> SeqTrait<T> for PublicSeq<T>

Source§

fn create(l: usize) -> Self

Get a new sequence of capacity l.

Source§

fn len(&self) -> usize

Source§

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

Source§

fn update_slice<A: SeqTrait<T>>( 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<T>>(self, start: usize, v: &A) -> Self

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

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

Source§

impl<T: Numeric + PublicInteger + Copy> Shl<usize> for PublicSeq<T>

Source§

type Output = PublicSeq<T>

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

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

Performs the << operation. Read more
Source§

impl<T: Numeric + PublicInteger + Copy> Shr<usize> for PublicSeq<T>

Source§

type Output = PublicSeq<T>

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

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

Performs the >> operation. Read more
Source§

impl<T: Numeric + PublicInteger + Copy> Sub for PublicSeq<T>

Polynomial subtraction on ℤ[x]

Source§

type Output = PublicSeq<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T: Copy + Default + PartialEq + PublicInteger> Eq for PublicSeq<T>

Auto Trait Implementations§

§

impl<T> Freeze for PublicSeq<T>

§

impl<T> RefUnwindSafe for PublicSeq<T>
where T: RefUnwindSafe,

§

impl<T> Send for PublicSeq<T>
where T: Send,

§

impl<T> Sync for PublicSeq<T>
where T: Sync,

§

impl<T> Unpin for PublicSeq<T>
where T: Unpin,

§

impl<T> UnwindSafe for PublicSeq<T>
where T: UnwindSafe,

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.