pub struct ResidueType { /* private fields */ }Expand description
The residues the infinite generator may take. See the module documentation.
Implementations§
Source§impl ResidueType
impl ResidueType
Sourcepub fn any() -> ResidueType
pub fn any() -> ResidueType
Nothing is known.
Sourcepub fn congruent(r: u64, m: u64) -> ResidueType
pub fn congruent(r: u64, m: u64) -> ResidueType
H ≡ r (mod m).
§Panics
When m is 0 or above MAX_MODULUS; a modulus a program supplies goes through
ResidueType::from_allowed, which refuses it instead.
pub fn modulus(&self) -> u64
Sourcepub fn allows(&self, r: u64, m: u64) -> bool
pub fn allows(&self, r: u64, m: u64) -> bool
Whether some admitted H has H ≡ r (mod m). By the Chinese remainder theorem that is
an admitted class s with s ≡ r modulo gcd(m, modulus), so any m is answered in time
linear in the type’s own modulus.
Sourcepub fn from_allowed(
m: u64,
allowed: &[u64],
) -> Result<ResidueType, ResidueError>
pub fn from_allowed( m: u64, allowed: &[u64], ) -> Result<ResidueType, ResidueError>
The type allowing exactly allowed modulo m (residues reduce modulo m): a
contradiction when nothing is allowed, too fine when m passes MAX_MODULUS.
Sourcepub fn residues(&self) -> Vec<u64>
pub fn residues(&self) -> Vec<u64>
The allowed residues modulo ResidueType::modulus, ascending.
Sourcepub fn and(&self, o: &ResidueType) -> Result<ResidueType, ResidueError>
pub fn and(&self, o: &ResidueType) -> Result<ResidueType, ResidueError>
Both facts at once.
Trait Implementations§
Source§impl Clone for ResidueType
impl Clone for ResidueType
Source§fn clone(&self) -> ResidueType
fn clone(&self) -> ResidueType
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResidueType
impl Debug for ResidueType
Source§impl ExactCodec for ResidueType
impl ExactCodec for ResidueType
Source§impl Hash for ResidueType
impl Hash for ResidueType
Source§impl PartialEq for ResidueType
impl PartialEq for ResidueType
impl Eq for ResidueType
impl StructuralPartialEq for ResidueType
Auto Trait Implementations§
impl Freeze for ResidueType
impl RefUnwindSafe for ResidueType
impl Send for ResidueType
impl Sync for ResidueType
impl Unpin for ResidueType
impl UnsafeUnpin for ResidueType
impl UnwindSafe for ResidueType
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