inst_derive

Crates.ioinst_derive
lib.rsinst_derive
version0.1.2
created_at2025-10-16 14:43:50.889368+00
updated_at2025-12-19 00:58:57.664903+00
descriptionDerive macro for tagged union enums implementing the Instantiable trait in safety-net
homepage
repositoryhttps://github.com/jk2997/inst_derive
max_upload_size
id1886225
size21,298
(jk2997)

documentation

README

crates.io

Description

Derive macro for the Instantiable trait in safety-net.

Makes it easier to group Instantiable structs into a single enum.

Example

Use the #[instantiable(constant)] attribute on a variant to specify which variant should be used for from_constant(). The variant must have a pub fn from_constant(val: Logic) -> Option<Self> method that returns an Option of the variant type.

use inst_derive::Instantiable;
use safety_net::{Gate, Identifier, Instantiable, Logic, Net, Parameter};
#[derive(Debug, Clone, Instantiable)]
enum Cell {
    #[instantiable(constant)]
    Gate(Gate),
    // additional variants
}
Commit count: 0

cargo fmt