From bc5e69152ffd59672fb44c4a0982367f8708e617 Mon Sep 17 00:00:00 2001 From: Kamen Mladenov Date: Mon, 10 Feb 2025 13:54:19 +0200 Subject: docs(zkvms/nexus): Add detailed documentation comments --- zkvms/nexus/wrapper_macro/src/lib.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'zkvms/nexus/wrapper_macro/src') 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); -- cgit v1.2.3