Crate hyperstack_macros

Crate hyperstack_macros 

Source
Expand description

§hyperstack-macros

Procedural macros for defining HyperStack streams.

This crate provides the #[hyperstack] attribute macro that transforms annotated Rust structs into full streaming pipeline specifications, including:

  • State struct generation with field accessors
  • Handler creation functions for event processing
  • IDL/Proto parser integration for Solana programs
  • Automatic AST serialization for deployment

§Module Usage (IDL-based)

use hyperstack_macros::{hyperstack, Stream};

#[hyperstack(idl = "idl.json")]
pub mod my_stream {
    #[entity(name = "MyEntity")]
    #[derive(Stream)]
    struct Entity {
        #[map(from = "MyAccount", field = "value")]
        pub value: u64,
    }
}

§Supported Attributes

  • #[map(...)] - Map from account fields
  • #[from_instruction(...)] - Map from instruction fields
  • #[event(...)] - Capture instruction events
  • #[snapshot(...)] - Capture entire source data
  • #[aggregate(...)] - Aggregate field values
  • #[computed(...)] - Computed fields from other fields
  • #[derive_from(...)] - Derive values from instructions

Attribute Macros§

hyperstack
Process a #[hyperstack(...)] attribute.

Derive Macros§

Stream
Derive macro for Stream.