From d69e4e7f11ff45e82dace6b861aebe665dccb303 Mon Sep 17 00:00:00 2001 From: Kamen Mladenov Date: Mon, 10 Feb 2025 14:06:57 +0200 Subject: docs(zkvms/risc0): Add detailed documentation comments --- zkvms/risc0/wrapper_macro/src/lib.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'zkvms/risc0/wrapper_macro') diff --git a/zkvms/risc0/wrapper_macro/src/lib.rs b/zkvms/risc0/wrapper_macro/src/lib.rs index 22afa44..24eddd4 100644 --- a/zkvms/risc0/wrapper_macro/src/lib.rs +++ b/zkvms/risc0/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 }; +/// Create a body, which reads all inputs, stores them in variables, then +/// commits the ones, defined as public in `default_public_input.toml` to the +/// journal and finally executes the guest entrypoint function with those +/// arguments, committing its output. +/// +/// # Usage +/// +/// Inside RISC0's guest (excluding the `entrypoint_expr` call): +/// +/// ```rust +/// make_wrapper!{fn main(...) -> ...} +/// ``` +/// +/// # Example output +/// +/// ```rust +/// { +/// let ... : ... = read(); +/// let ... : ... = read(); +/// ... +/// commit(&...); +/// commit(&...); +/// ... +/// commit(&zkp::main(..., ..., ...)); +/// } +/// ``` #[proc_macro] pub fn make_wrapper(item: TokenStream) -> TokenStream { let (name, args, ret) = split_fn(&item); -- cgit v1.2.3