pub trait ActionParams: Action {
// Required method
fn params(&self) -> String;
}Expand description
Trait for getting action parameters without the variant name.
Auto-implemented by #[derive(Action)]. Returns just the field values
as a string, suitable for display in action logs where the action name
is already shown separately.
§Example
ⓘ
#[derive(Action, Clone, Debug)]
enum MyAction {
SetFilter { query: String, limit: usize },
Tick,
}
let action = MyAction::SetFilter { query: "foo".into(), limit: 10 };
assert_eq!(action.name(), "SetFilter");
assert_eq!(action.params(), r#""foo", 10"#);
let tick = MyAction::Tick;
assert_eq!(tick.params(), "");Required Methods§
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.