Skip to main content

Crate consortium_tee_macros_impl

Crate consortium_tee_macros_impl 

Source
Expand description

Macro implementations behind consortium-tee-macros.

The logic for consortium-tee’s three macros lives here as ordinary proc_macro2::TokenStream functions, outside the proc-macro = true facade, so expansions can be asserted with unit tests and insta snapshots rather than only through trybuild. That matters more here than for the other macro families: these macros generate both sides of a privilege boundary, and the generated code is not something a reader can easily hold in their head.

ModuleGenerates
tee_paramimpl<C: CodecFor<Self>> TeeParam<C> for a user type.
tee_commandcall_<name> (CA) and <name>_dispatched (TA) for one function.
tee_serviceThe Command enum and invoke_command dispatch for a TA.

The load-bearing design decision, shared by all three: the codec is a type parameter, never baked into an expansion. tee_param emits an impl generic over C and tee_command substitutes the codec = … argument at the call site. A message type is therefore reusable across commands with different codecs, and shareable with the IPC layer without inheriting its codec.

Reusable syn predicates — is_primitive, is_slice_ref, is_tee_param_path, collect_field_types, and friends — live in consortium-macros-helpers, because tee_command’s parameter classification and tee_param’s field validation need the same AST questions answered. What stays here is TEE-specific policy: which Rust type maps to which parameter slot, and in which direction.

This is an implementation detail of consortium-tee. Do not depend on it directly; its API is not stable.

Functions§

derive_tee_param
Derive macro for consortium_tee::TeeParam.
tee_command
Generates two companion functions for a TA command handler.
tee_service
Input: