carykh-macro-rust

Crates.iocarykh-macro-rust
lib.rscarykh-macro-rust
version0.1.2
sourcesrc
created_at2024-10-14 06:41:33.79917
updated_at2024-10-14 07:10:47.573679
descriptionA rust macro for finding strings that contain self-referential numbers. Inspired by carykh. This description contains twenty-seven words, fifty-four vowels, and ninety-nine consonants.
homepage
repositoryhttps://github.com/thatchedroof/carykh-macro-rust
max_upload_size
id1408003
size11,834
(thatchedroof)

documentation

README

A rust macro for finding strings that contain self-referential numbers. Inspired by carykh. This description contains twenty-seven words, fifty-four vowels, and ninety-nine consonants.

Usage

// This sentence has thirty-one letters.
let s = carykh_optimize!("This sentence has {} letters.", count_letters).unwrap();
println!("{}", s);

// This sentence has twenty-two vowels and thirty-eight consonants. Hooray!
let s = carykh_optimize!(
    "This sentence has {} vowels and {} consonants. Hooray!",
    count_vowels,
    count_consonants
)
.unwrap();
println!("{}", s);

// Number of words of each length in this bar graph:
// (three) two-letter-words,
// (three) three-letter-words,
// (five) four-letter-words,
// (eleven) five-letter-words,
// (eight) six-letter-words
let s = carykh_optimize!(
    "Number of words of each length in this bar graph:\n({}) two-letter-words,\n({}) three-letter-words,\n({}) four-letter-words,\n({}) five-letter-words,\n({}) six-letter-words",
    count_words_of_length_n(2),
    count_words_of_length_n(3),
    count_words_of_length_n(4),
    count_words_of_length_n(5),
    count_words_of_length_n(6)
).unwrap();
println!("{}", s);

// Number of vowels and consonants in this mesmerizing pie chart:
// Vowels: Thirty-Four percent
// Consonants: Sixty-Six percent
let s = carykh_optimize!(
    "Number of vowels and consonants in this mesmerizing pie chart\nVowels: {} percent\nConsonants: {} percent",
    count_vowels,
    count_consonants;
    {
        formatting = Formatting::all(),
        condition = has_n_letters(100)
    }
).unwrap();
println!("{}", s);
Commit count: 0

cargo fmt