Crates.io | carykh-macro-rust |
lib.rs | carykh-macro-rust |
version | 0.1.2 |
source | src |
created_at | 2024-10-14 06:41:33.79917 |
updated_at | 2024-10-14 07:10:47.573679 |
description | 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. |
homepage | |
repository | https://github.com/thatchedroof/carykh-macro-rust |
max_upload_size | |
id | 1408003 |
size | 11,834 |
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.
// 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);