diff --git a/src/generation.rs b/src/generation.rs index 33cdfbe..dff94f4 100644 --- a/src/generation.rs +++ b/src/generation.rs @@ -159,7 +159,7 @@ pub const fn primes() -> [Underlying; N] { /// # use const_primes::{primes_lt, GenerationError}; /// const TOO_LARGE_LIMIT: Result<[u64; 3], GenerationError> = primes_lt::<3, 5>(26); /// const TOO_SMALL_LIMIT: Result<[u64; 1], GenerationError> = primes_lt::<1, 1>(1); -/// assert_eq!(TOO_LARGE_LIMIT, Err(GenerationError::TooLargeLimit)); +/// assert_eq!(TOO_LARGE_LIMIT, Err(GenerationError::NotEnoughMemory)); /// assert_eq!(TOO_SMALL_LIMIT, Err(GenerationError::TooSmallLimit)); /// ``` /// @@ -186,7 +186,7 @@ pub const fn primes_lt( } if upper_limit > mem_sqr { - return Err(GenerationError::TooLargeLimit); + return Err(GenerationError::NotEnoughMemory); } let mut primes: [u64; N] = [0; N]; @@ -321,7 +321,7 @@ macro_rules! primes_segment { /// ``` /// # use const_primes::{primes_geq, GenerationError}; /// const PRIMES: Result<[u64; 5], GenerationError> = primes_geq::<5, 5>(26); -/// assert_eq!(PRIMES, Err(GenerationError::TooLargeLimit)); +/// assert_eq!(PRIMES, Err(GenerationError::NotEnoughMemory)); /// ``` /// /// # Panics @@ -356,7 +356,7 @@ pub const fn primes_geq( } if lower_limit >= mem_sqr { - return Err(GenerationError::TooLargeLimit); + return Err(GenerationError::NotEnoughMemory); } let mut primes = [0; N]; @@ -401,7 +401,7 @@ pub const fn primes_geq( #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum GenerationError { /// The limit was larger than or equal to `MEM^2`. - TooLargeLimit, + NotEnoughMemory, /// The limit was smaller than or equal to 2. TooSmallLimit, /// Encountered a number larger than or equal to `MEM`^2. @@ -413,7 +413,7 @@ pub enum GenerationError { impl fmt::Display for GenerationError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - Self::TooLargeLimit => write!( + Self::NotEnoughMemory => write!( f, "the limit was larger than `MEM`^2" ),