Skip to main content

elo_rust/stdlib/
mod.rs

1//! Standard library function implementations
2//!
3//! Defines all supported ELO standard library functions that can be called
4//! from generated validators
5
6pub mod array;
7pub mod datetime;
8pub mod string;
9pub mod types;
10
11/// Standard library function metadata
12#[derive(Debug, Clone, PartialEq, Eq)]
13pub struct FunctionSignature {
14    /// Function name
15    pub name: String,
16    /// Parameter types (as strings)
17    pub params: Vec<String>,
18    /// Return type
19    pub return_type: String,
20    /// Function category
21    pub category: FunctionCategory,
22}
23
24/// Categories of standard library functions
25#[derive(Debug, Clone, Copy, PartialEq, Eq)]
26pub enum FunctionCategory {
27    /// String manipulation
28    String,
29    /// Date and time operations
30    DateTime,
31    /// Array/collection operations
32    Array,
33    /// Type checking and conversion
34    Type,
35}
36
37#[cfg(test)]
38mod tests {
39    use super::*;
40
41    #[test]
42    fn test_function_signature_creation() {
43        let sig = FunctionSignature {
44            name: "matches".to_string(),
45            params: vec!["&str".to_string(), "&str".to_string()],
46            return_type: "bool".to_string(),
47            category: FunctionCategory::String,
48        };
49        assert_eq!(sig.name, "matches");
50        assert_eq!(sig.params.len(), 2);
51    }
52}