pub trait ActionCategory: Action {
type Category: Copy + Eq + Hash + Debug;
// Required methods
fn category(&self) -> Option<&'static str>;
fn category_enum(&self) -> Self::Category;
}Expand description
Extension trait for actions with category support
This trait is auto-implemented when using #[derive(Action)] with
#[action(infer_categories)]. It provides methods to query an action’s
category for routing and filtering.
§Example
ⓘ
use tui_dispatch::ActionCategory;
#[derive(Action, Clone, Debug)]
#[action(infer_categories)]
enum MyAction {
SearchStart,
SearchClear,
ConnectionFormOpen,
}
let action = MyAction::SearchStart;
assert_eq!(action.category(), Some("search"));
assert!(matches!(action.category_enum(), MyActionCategory::Search));Required Associated Types§
Required Methods§
Sourcefn category(&self) -> Option<&'static str>
fn category(&self) -> Option<&'static str>
Get the action’s category as a string (if categorized)
Sourcefn category_enum(&self) -> Self::Category
fn category_enum(&self) -> Self::Category
Get the action’s category as an enum value
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.