pub struct Depends<T> { /* private fields */ }Expand description
A quantity on every residue class of the generator. See the module documentation.
Implementations§
Source§impl<T: Clone + PartialEq> Depends<T>
impl<T: Clone + PartialEq> Depends<T>
pub fn constant(v: T, ty: &ResidueType) -> Depends<T>
Sourcepub fn from_fn(
m: u64,
ty: &ResidueType,
f: impl Fn(u64) -> T,
) -> Result<Depends<T>, ResidueError>
pub fn from_fn( m: u64, ty: &ResidueType, f: impl Fn(u64) -> T, ) -> Result<Depends<T>, ResidueError>
The quantity f(H mod m) on the classes the type admits; refused when m and the type’s
modulus together pass MAX_MODULUS.
Sourcepub fn from_branches(
ty: ResidueType,
m: u64,
raw: Vec<Option<T>>,
) -> Option<Depends<T>>
pub fn from_branches( ty: ResidueType, m: u64, raw: Vec<Option<T>>, ) -> Option<Depends<T>>
Rebuild a quantity from its value on every class modulo m (None exactly for the classes
ty rules out), held at its smallest modulus; None when the classes and the type disagree.
Sourcepub fn raw_branches(&self) -> Vec<Option<T>>
pub fn raw_branches(&self) -> Vec<Option<T>>
The value on every class modulo Depends::modulus, None for a class the type rules out.
pub fn modulus(&self) -> u64
pub fn residue_type(&self) -> &ResidueType
Sourcepub fn branches(&self) -> impl Iterator<Item = (u64, &T)>
pub fn branches(&self) -> impl Iterator<Item = (u64, &T)>
The admitted classes and their values, by residue.
pub fn map<U: Clone + PartialEq>(&self, f: impl Fn(&T) -> U) -> Depends<U>
Trait Implementations§
Source§impl<T: ExactCodec + Clone + PartialEq> ExactCodec for Depends<T>
impl<T: ExactCodec + Clone + PartialEq> ExactCodec for Depends<T>
Source§fn write(&self, out: &mut Vec<u8>)
fn write(&self, out: &mut Vec<u8>)
The residue type, the modulus, then each class’s value (0 for a class the type rules out,
1 and the value otherwise).
fn read(buf: &[u8], pos: &mut usize) -> Option<Self>
fn to_bytes(&self) -> Vec<u8> ⓘ
Source§fn from_bytes(buf: &[u8]) -> Option<Self>
fn from_bytes(buf: &[u8]) -> Option<Self>
The value
buf canonically encodes, with nothing left over.impl<T: Eq> Eq for Depends<T>
impl<T> StructuralPartialEq for Depends<T>
Auto Trait Implementations§
impl<T> Freeze for Depends<T>
impl<T> RefUnwindSafe for Depends<T>where
T: RefUnwindSafe,
impl<T> Send for Depends<T>where
T: Send,
impl<T> Sync for Depends<T>where
T: Sync,
impl<T> Unpin for Depends<T>where
T: Unpin,
impl<T> UnsafeUnpin for Depends<T>
impl<T> UnwindSafe for Depends<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more