Skip to main content

system2_shared/
score.rs

1//! The limits and the messages of the levels of a Score.
2
3/// The most levels that a Score can have.
4pub const MAX_LEVELS: usize = 10;
5
6/// Returns the message for a Score with no levels, or with too many.
7#[must_use]
8pub fn count_message(count: usize) -> String {
9    format!("a Score must have 1 to {MAX_LEVELS} levels, not {count}")
10}
11
12/// Returns the message for two levels that are the same.
13#[must_use]
14pub fn duplicate_message(first: usize, second: usize) -> String {
15    format!(
16        "each level must be different, but the levels at index {first} and {second} are the same"
17    )
18}