indefinite/macros.rs
1/// Returns the input string with the article related to the first word (also accepts a list of input string)
2///
3/// # Examples
4///
5/// ```
6/// use indefinite::indefinite;
7///
8/// assert_eq!(indefinite!("honor"), "an honor");
9/// assert_eq!(indefinite!("honor", "euro"), ["an honor", "a euro"]);
10/// ```
11#[macro_export]
12macro_rules! indefinite {
13 ($word:literal) => {
14 $crate::indefinite($word)
15 };
16
17 ($($word:literal),+) => {{
18 [$($crate::indefinite($word),)+]
19 }};
20}
21
22/// Returns the input string with the article related to the first word with the first letter capitalised (also accepts a list of input string)
23///
24/// # Examples
25///
26/// ```
27/// use indefinite::indefinite_capitalized;
28///
29/// assert_eq!(indefinite_capitalized!("apple"), "An apple");
30/// assert_eq!(indefinite_capitalized!("banana", "pear"), ["A banana", "A pear"]);
31/// ```
32#[macro_export]
33macro_rules! indefinite_capitalized {
34 ($word:literal) => {
35 $crate::indefinite_capitalized($word)
36 };
37
38 ($($word:literal),+) => {{
39 [$($crate::indefinite_capitalized($word),)+]
40 }};
41}
42
43/// Returns only the article related to the first word (also accepts a list of input string)
44///
45/// # Examples
46///
47/// ```
48/// use indefinite::indefinite_article_only;
49///
50/// assert_eq!(indefinite_article_only!("apple"), "an");
51/// assert_eq!(indefinite_article_only!("apple","pear"), ["an", "a"]);
52/// ```
53#[macro_export]
54macro_rules! indefinite_article_only {
55 ($word:literal) => {
56 $crate::indefinite_article_only($word)
57 };
58
59 ($($word:literal),+) => {{
60 [$($crate::indefinite_article_only($word),)+]
61 }};
62}
63
64/// Returns only the article related to the first word with the first letter capitalised (also accepts a list of input string)
65///
66/// # Examples
67///
68/// ```
69/// use indefinite::indefinite_article_only_capitalized;
70///
71/// assert_eq!(indefinite_article_only_capitalized!("apple"), "An");
72/// assert_eq!(indefinite_article_only_capitalized!("apple", "pear"), ["An", "A"]);
73/// ```
74#[macro_export]
75macro_rules! indefinite_article_only_capitalized {
76 ($word:literal) => {
77 $crate::indefinite_article_only_capitalized($word)
78 };
79
80 ($($word:literal),+) => {{
81 [$($crate::indefinite_article_only_capitalized($word),)+]
82 }};
83}