Skip to main content

formualizer_common/
function.rs

1#[derive(Copy, Clone, Debug, Eq, PartialEq)]
2pub enum ArgKind {
3    Number,
4    Text,
5    Logical,
6    Range,
7    Any,
8}
9
10#[derive(Debug, Clone, Copy, PartialEq, Eq)]
11pub enum CoercionPolicy {
12    None,
13    NumberStrict,
14    NumberLenientText,
15    Logical,
16    Criteria,
17    DateTimeSerial,
18}
19
20impl ArgKind {
21    pub fn parse(s: &str) -> Self {
22        match s.trim().to_ascii_lowercase().as_str() {
23            "number" => Self::Number,
24            "text" => Self::Text,
25            "logical" => Self::Logical,
26            "range" => Self::Range,
27            "" | "_" | "any" => Self::Any,
28            other => panic!("Unknown arg kind '{other}'"),
29        }
30    }
31}