Make macro system and PTY test leaf

This commit is contained in:
Michael Mikovsky
2026-05-28 18:17:01 -06:00
parent aeffe8b8ec
commit fc82f4f921
23 changed files with 1866 additions and 86 deletions
+23
View File
@@ -0,0 +1,23 @@
[package]
name = "unshell-macros"
version.workspace = true
edition.workspace = true
description = "Procedural macros for UnShell leaves"
[lib]
proc-macro = true
[dependencies]
unshell-macros-core = { workspace = true }
[lints.rust]
elided_lifetimes_in_paths = "warn"
future_incompatible = { level = "warn", priority = -1 }
nonstandard_style = { level = "warn", priority = -1 }
rust_2018_idioms = { level = "warn", priority = -1 }
rust_2021_prelude_collisions = "warn"
semicolon_in_expressions_from_macros = "warn"
unsafe_op_in_unsafe_fn = "warn"
unused_import_braces = "warn"
unused_lifetimes = "warn"
trivial_casts = "allow"
+15
View File
@@ -0,0 +1,15 @@
//! Procedural macro shim for UnShell.
//!
//! The real parser and code generator live in `unshell-macros-core` so they can be
//! tested as ordinary Rust. This crate only adapts compiler `TokenStream`s.
use proc_macro::TokenStream;
/// Generates an `unshell_protocol::Leaf` wrapper for a user-owned state struct.
///
/// See `LEAF_MACRO_INTERFACE.md` for the design contract. The generated wrapper owns
/// session stores, retry queues, filtered packet dispatch, and final-frame cleanup.
#[proc_macro_attribute]
pub fn unshell_leaf(attr: TokenStream, item: TokenStream) -> TokenStream {
unshell_macros_core::expand_unshell_leaf(attr.into(), item.into()).into()
}