#[attr_interface]Expand description
Declare an Attribute interface,
which can be implemented by any Attribute.
If the interface requires any other interface to be already implemented, they can be specified super-traits.
When an Attribute is verified, its interfaces are also automatically verified,
with guarantee that a super-interface is verified before an interface itself is.
Example: Here Super1 and Super2 are super interfaces for the interface MyAttrIntr.
use pliron::derive::attr_interface;
#[attr_interface]
trait Super1 {
fn verify(_attr: &dyn Attribute, _ctx: &Context) -> Result<()>
where
Self: Sized,
{
Ok(())
}
}
#[attr_interface]
trait Super2 {
fn verify(_attr: &dyn Attribute, _ctx: &Context) -> Result<()>
where
Self: Sized,
{
Ok(())
}
}
// MyAttrIntr is my best attribute interface.
#[attr_interface]
trait MyAttrIntr: Super1 + Super2 {
fn verify(_attr: &dyn Attribute, _ctx: &Context) -> Result<()>
where
Self: Sized,
{
Ok(())
}
}