From 1cb88615eaa0b6a37d42d99c59ad1e23c5d5aa7a Mon Sep 17 00:00:00 2001 From: Kamen Mladenov Date: Mon, 10 Feb 2025 14:29:15 +0200 Subject: docs(zkvms/zkm): Add detailed documentation comments --- zkvms/zkm/wrapper_macro/src/lib.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'zkvms/zkm/wrapper_macro/src/lib.rs') diff --git a/zkvms/zkm/wrapper_macro/src/lib.rs b/zkvms/zkm/wrapper_macro/src/lib.rs index 4bb580c..216d3d8 100644 --- a/zkvms/zkm/wrapper_macro/src/lib.rs +++ b/zkvms/zkm/wrapper_macro/src/lib.rs @@ -4,6 +4,29 @@ use proc_macro::TokenStream; mod parse_fn; use crate::parse_fn::{ split_fn, args_split, args_divide_public, args_divide_grouped, group_streams }; +/// Create a body, which reads all public and private inputs, stores them in +/// variables, then executes the guest entrypoint function with those arguments +/// and commits its output. +/// +/// `default_public_input.toml` shows which variables are public. +/// +/// # Usage +/// +/// Inside ZKM's guest (excluding the `entrypoint_expr` call): +/// +/// ```rust +/// make_wrapper!{fn main(...) -> ...} +/// ``` +/// +/// # Example output +/// +/// ```rust +/// { +/// let (...) : (...) = read(); // Public inputs +/// let (...) : (...) = read(); // Private inputs +/// commit::<...>(&zkp::main(..., ..., ...)); +/// } +/// ``` #[proc_macro] pub fn make_wrapper(item: TokenStream) -> TokenStream { let (name, args, ret) = split_fn(&item); -- cgit v1.2.3