Skip to content

Commit

Permalink
Also mention Primes<N>.into_array() in lib.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
JSorngard committed Jul 30, 2024
1 parent e39ab2b commit 321f57f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,17 @@
//! assert!(CACHE.is_prime(1000).is_none());
//! assert!(CACHE.count_primes_leq(1000).is_none());
//! ```
//! Want only the numbers? Use the function [`primes`]:
//! Want only the numbers? Use the function [`primes`], or convert the cache into an array:
//! ```
//! use const_primes::primes;
//! use const_primes::{primes, Primes};
//!
//! const PRIMES: [u32; 10] = primes();
//! const CACHE: Primes<10> = Primes::new();
//!
//! assert_eq!(PRIMES[5], 13);
//! assert_eq!(PRIMES, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]);
//! const PRIMES_ARRAY1: [u32; 10] = primes();
//! const PRIMES_ARRAY2: [u32; 10] = CACHE.into_array();
//!
//! assert_eq!(PRIMES_ARRAY1, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]);
//! assert_eq!(PRIMES_ARRAY1, PRIMES_ARRAY2);
//! ```
//!
//! # Example: primality checking
Expand Down

0 comments on commit 321f57f

Please sign in to comment.