substrate::block

Derive Macro Block

Source
#[derive(Block)]
{
    // Attributes available to this derive:
    #[substrate]
}
Expand description

Derives substrate::block::Block for a struct or enum.

You must specify the block’s IO by adding a #[substrate(io = "IoType")] attribute:

use substrate::block::Block;

#[derive(Block, Copy, Clone, Eq, PartialEq, Hash, Debug)]
#[substrate(io = "substrate::types::TestbenchIo")]
pub struct MyBlock {
  // ...
}

This derive macro only works if you want to use the default value of the IO. If the IO type does not implement [Default], or you want to use a non-default value, you must implement Block manually.