Skip to content

Commit

Permalink
TooLargeLimit --> NotEnoughMemory
Browse files Browse the repository at this point in the history
  • Loading branch information
JSorngard committed May 10, 2024
1 parent cecccfa commit 5db18d3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/generation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ pub const fn primes<const N: usize>() -> [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));
/// ```
///
Expand All @@ -186,7 +186,7 @@ pub const fn primes_lt<const N: usize, const MEM: usize>(
}

if upper_limit > mem_sqr {
return Err(GenerationError::TooLargeLimit);
return Err(GenerationError::NotEnoughMemory);
}

let mut primes: [u64; N] = [0; N];
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -356,7 +356,7 @@ pub const fn primes_geq<const N: usize, const MEM: usize>(
}

if lower_limit >= mem_sqr {
return Err(GenerationError::TooLargeLimit);
return Err(GenerationError::NotEnoughMemory);
}

let mut primes = [0; N];
Expand Down Expand Up @@ -401,7 +401,7 @@ pub const fn primes_geq<const N: usize, const MEM: usize>(
#[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.
Expand All @@ -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"
),
Expand Down

0 comments on commit 5db18d3

Please sign in to comment.