use super::{EventParam, ParamType};
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct Event {
pub name: String,
pub inputs: Vec<EventParam>,
pub anonymous: bool,
}
impl Event {
pub fn params_names(&self) -> Vec<String> {
self.inputs.iter()
.map(|p| p.name.clone())
.collect()
}
pub fn param_types(&self) -> Vec<ParamType> {
self.inputs.iter()
.map(|p| p.kind.clone())
.collect()
}
pub fn indexed_params(&self, indexed: bool) -> Vec<EventParam> {
self.inputs.iter()
.filter(|p| p.indexed == indexed)
.cloned()
.collect()
}
}