Skip to main content

Emit

Derive Macro Emit 

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

Derive Emit<T> for a proxy enum that dispatches to inner builders.

Each variant must be a single-field newtype. The target type is specified via #[emit(TargetType)]. All generic type parameters receive an Emit<TargetType> bound.

§Example

#[derive(Emit)]
#[emit(Block)]
enum BlockEmit<A, B, C> {
  Br(A),
  Brif(B),
  Call(C),
}

This generates unsafe impl<A: Emit<Block>, B: Emit<Block>, C: Emit<Block>> Emit<Block> for BlockEmit<A, B, C>, where each variant delegates write_at to its inner value.