From 321f57fb7fb5b72cc664716df1aec2e501fb3bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20S=C3=B6rng=C3=A5rd?= Date: Tue, 30 Jul 2024 08:43:13 +0200 Subject: [PATCH] Also mention Primes.into_array() in lib.rs --- src/lib.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d07bcb8..457eaeb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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