//! Code generation - Generate trait implementations from IR

mod enum_codegen;
mod helpers;
mod struct_codegen;

use proc_macro2::TokenStream;

use crate::ir::Definition;

use enum_codegen::generate_enum_impl;
use struct_codegen::generate_struct_impl;

/// Generate all trait implementations for a Definition (enum or struct)
pub(crate) fn generate(def: &Definition) -> TokenStream {
    match def {
        Definition::Enum(ir) => generate_enum_impl(ir),
        Definition::Struct(ir) => generate_struct_impl(ir),
    }
}
