diff options
| author | Kamen Mladenov <kamen@syndamia.com> | 2025-02-10 13:54:19 +0200 |
|---|---|---|
| committer | Kamen Mladenov <kamen@syndamia.com> | 2025-02-10 13:54:19 +0200 |
| commit | bc5e69152ffd59672fb44c4a0982367f8708e617 (patch) | |
| tree | efff94148941f531ed839c7c92047858eff7d24a /zkvms/nexus/wrapper_macro | |
| parent | f7572a87125d2374ce9f95fb5b96de099c5b51b5 (diff) | |
| download | zkVMs-benchmarks-bc5e69152ffd59672fb44c4a0982367f8708e617.tar zkVMs-benchmarks-bc5e69152ffd59672fb44c4a0982367f8708e617.tar.gz zkVMs-benchmarks-bc5e69152ffd59672fb44c4a0982367f8708e617.zip | |
docs(zkvms/nexus): Add detailed documentation comments
Diffstat (limited to 'zkvms/nexus/wrapper_macro')
| -rw-r--r-- | zkvms/nexus/wrapper_macro/src/lib.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/zkvms/nexus/wrapper_macro/src/lib.rs b/zkvms/nexus/wrapper_macro/src/lib.rs index 89ddc05..8682ab1 100644 --- a/zkvms/nexus/wrapper_macro/src/lib.rs +++ b/zkvms/nexus/wrapper_macro/src/lib.rs @@ -4,6 +4,32 @@ use proc_macro::TokenStream; mod parse_fn; use crate::parse_fn::{ split_fn, args_split, args_divide_public, args_divide_grouped }; +/// Creates a body, which reads all inputs, stores them in variables, then +/// writes the ones, defined as public in `default_public_input.toml` to the +/// journal and finally executes the guest entrypoint function with those +/// arguments. +/// +/// # Usage +/// +/// Inside Nexus' guest (excluding the `entrypoint_expr` call): +/// +/// ```rust +/// make_wrapper!{fn main(...) -> ...} +/// ``` +/// +/// # Example output +/// +/// ```rust +/// { +/// let ... = read_private_input::<...>().unwrap(); +/// let ... = read_private_input::<...>().unwrap(); +/// ... +/// write_output::<...>(&...); +/// write_output::<...>(&...); +/// ... +/// write_output::<...>(&zkp::main(..., ..., ...)); +/// } +/// ``` #[proc_macro] pub fn make_wrapper(item: TokenStream) -> TokenStream { let (name, args, ret) = split_fn(&item); |
