ingraph-codegen 0.1.0

The emission engine behind ingraph-derive: a plain declaration model in, the ingraph framework faces out.
Documentation
//! The UNION half of an interface's expansion — the same face, through the same seam.
//!
//! An interface's members are alternatives, so the question Rust asks of them is the union's:
//! which member is held, and how to get at it. [`Equipped`](crate::union::Equipped) is that
//! emission, and this is its second caller — so an interface's `is_<member>`,
//! `unwrap_<member>` family and sealed refusal are not a second implementation of the union's but
//! the same one, reached with a different model.
//!
//! What that buys is the property a copy could not keep: a receiver the union grows, a doc line it
//! rewords, a constness it settles differently all arrive here without anyone editing this file.

use crate::{interface::InterfaceModel, union::Equipped};

impl InterfaceModel {
  /// The member face and the refusal a wrong-variant unwrap answers with.
  pub(crate) fn union_face(&self) -> proc_macro2::TokenStream {
    Equipped {
      vis: &self.vis,
      name: &self.name,
      members: &self.members,
      error: self.error(),
    }
    .emit()
  }
}