aimx/info_library/
categories.rs

1//! Function categorization system for logical organization and discovery.
2
3/// Standard function categories for navigation and filtering.
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
5pub enum FunctionCategory {
6    Text,
7    Math, 
8    Business,
9    Date,
10    Collection,
11    Statistical,
12    Functional,
13    Set,
14    Task,
15    Utility,
16}
17
18impl FunctionCategory {
19    /// All available category names for API usage.
20    pub fn all() -> Vec<&'static str> {
21        vec![
22            "text",
23            "math",
24            "business", 
25            "date",
26            "collection",
27            "statistical",
28            "functional",
29            "set",
30            "task",
31            "utility",
32        ]
33    }
34    
35    /// Human-readable description for each category.
36    pub fn description(&self) -> &'static str {
37        match self {
38            FunctionCategory::Text => "String manipulation, formatting, and text processing",
39            FunctionCategory::Math => "Mathematical calculations, trigonometry, and constants",
40            FunctionCategory::Business => "Financial calculations, percentages, and business metrics",
41            FunctionCategory::Date => "Date parsing, formatting, and time manipulation",
42            FunctionCategory::Collection => "Array operations, filtering, mapping, and manipulation",
43            FunctionCategory::Statistical => "Statistical analysis, data science, and analytics",
44            FunctionCategory::Functional => "Higher-order functions and functional programming patterns",
45            FunctionCategory::Set => "Set operations on arrays (union, intersection, etc.)",
46            FunctionCategory::Task => "Task management for agentic workflows and automation",
47            FunctionCategory::Utility => "Debugging, testing, and utility functions",
48        }
49    }
50    
51    /// Get category from string name.
52    pub fn from_str(name: &str) -> Option<Self> {
53        match name {
54            "text" => Some(FunctionCategory::Text),
55            "math" => Some(FunctionCategory::Math),
56            "business" => Some(FunctionCategory::Business),
57            "date" => Some(FunctionCategory::Date),
58            "collection" => Some(FunctionCategory::Collection),
59            "statistical" => Some(FunctionCategory::Statistical),
60            "functional" => Some(FunctionCategory::Functional),
61            "set" => Some(FunctionCategory::Set),
62            "task" => Some(FunctionCategory::Task),
63            "utility" => Some(FunctionCategory::Utility),
64            _ => None,
65        }
66    }
67}