pub_just/parameter_kind.rs
1use super::*;
2
3/// Parameters can either be…
4#[derive(Debug, Copy, Clone, Eq, PartialEq, Serialize)]
5#[serde(rename_all = "snake_case")]
6pub enum ParameterKind {
7 /// …singular, accepting a single argument
8 Singular,
9 /// …variadic, accepting one or more arguments
10 Plus,
11 /// …variadic, accepting zero or more arguments
12 Star,
13}
14
15impl ParameterKind {
16 pub fn prefix(self) -> Option<&'static str> {
17 match self {
18 Self::Singular => None,
19 Self::Plus => Some("+"),
20 Self::Star => Some("*"),
21 }
22 }
23
24 pub fn is_variadic(self) -> bool {
25 self != Self::Singular
26 }
27}