#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum AttrType {
U32,
I32,
F32,
Bool,
Bytes,
String,
Enum(&'static [&'static str]),
Unknown,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AttrSchema {
pub name: &'static str,
pub ty: AttrType,
pub default: Option<&'static str>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TypedParam {
pub name: &'static str,
pub ty: &'static str,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Signature {
pub inputs: &'static [TypedParam],
pub outputs: &'static [TypedParam],
pub attrs: &'static [AttrSchema],
pub bytes_extraction: bool,
}
impl Signature {
#[must_use]
pub const fn bytes_extractor(
inputs: &'static [TypedParam],
outputs: &'static [TypedParam],
attrs: &'static [AttrSchema],
) -> Self {
Self {
inputs,
outputs,
attrs,
bytes_extraction: true,
}
}
}
#[cfg(test)]
mod tests;