pub struct PrimalityRegistry<N: PrimInt> { /* private fields */ }Expand description
Registry for managing and comparing primality testing algorithms
The registry maintains a collection of algorithm implementations and provides convenient methods for registering new algorithms and accessing them by name.
Implementations§
Source§impl<N: PrimInt + ToPrimitive + FromPrimitive + Unsigned> PrimalityRegistry<N>
impl<N: PrimInt + ToPrimitive + FromPrimitive + Unsigned> PrimalityRegistry<N>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new empty registry
Use this if you want to manually register specific algorithms.
To get all registered algorithms at once, use with_all_algorithms().
Sourcepub fn with_all_algorithms() -> Self
pub fn with_all_algorithms() -> Self
Creates a registry with all available algorithms
This is the recommended way to create a registry if you want to use all implemented algorithms.
Sourcepub fn register<T: PrimalityTest<N> + 'static>(&mut self, algo: T)
pub fn register<T: PrimalityTest<N> + 'static>(&mut self, algo: T)
Registers a new primality test algorithm
§Arguments
algo- The algorithm to register, must implementPrimalityTest
Sourcepub fn algorithms(&self) -> &[Box<dyn PrimalityTest<N>>]
pub fn algorithms(&self) -> &[Box<dyn PrimalityTest<N>>]
Returns a slice of all registered algorithms
Sourcepub fn get_by_name(&self, name: &str) -> Option<&Box<dyn PrimalityTest<N>>>
pub fn get_by_name(&self, name: &str) -> Option<&Box<dyn PrimalityTest<N>>>
Trait Implementations§
Source§impl<N: PrimInt + ToPrimitive + FromPrimitive + Unsigned> Default for PrimalityRegistry<N>
impl<N: PrimInt + ToPrimitive + FromPrimitive + Unsigned> Default for PrimalityRegistry<N>
Auto Trait Implementations§
impl<N> !RefUnwindSafe for PrimalityRegistry<N>
impl<N> !Send for PrimalityRegistry<N>
impl<N> !Sync for PrimalityRegistry<N>
impl<N> !UnwindSafe for PrimalityRegistry<N>
impl<N> Freeze for PrimalityRegistry<N>
impl<N> Unpin for PrimalityRegistry<N>
impl<N> UnsafeUnpin for PrimalityRegistry<N>
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