Skip to main content

bynk_check/
builtin_names.rs

1//! Centralised string literals for the language's built-in vocabulary (refactor
2//! track item 8, v0.29.11). Built-in type/method names were compared as bare
3//! string literals scattered across the checker, emitter, and project modules;
4//! a typo was a silent never-match. One edit point per name now.
5
6/// Built-in type names (as they appear in source / qualified positions).
7pub mod types {
8    pub const JSON: &str = "Json";
9    pub const LIST: &str = "List";
10    pub const MAP: &str = "Map";
11    pub const INT: &str = "Int";
12    pub const FLOAT: &str = "Float";
13    pub const DURATION: &str = "Duration";
14    pub const INSTANT: &str = "Instant";
15    pub const BYTES: &str = "Bytes";
16    pub const HTTP_RESULT: &str = "HttpResult";
17    pub const QUEUE_RESULT: &str = "QueueResult";
18    pub const STREAM: &str = "Stream";
19}
20
21/// Privileged built-in member names — constructors (`of`/`unsafe`), the refined
22/// raw accessor (`raw`), and the effect fold (`foldEff`).
23pub mod methods {
24    pub const OF: &str = "of";
25    pub const UNSAFE: &str = "unsafe";
26    pub const RAW: &str = "raw";
27    pub const FOLD_EFF: &str = "foldEff";
28}
29
30#[cfg(test)]
31mod tests {
32    use super::*;
33
34    #[test]
35    fn constants_hold_expected_values() {
36        assert_eq!(types::JSON, "Json");
37        assert_eq!(types::HTTP_RESULT, "HttpResult");
38        assert_eq!(methods::OF, "of");
39        assert_eq!(methods::FOLD_EFF, "foldEff");
40    }
41}