1 unstable release

0.1.0 Jan 29, 2022

#84 in #runtime

Download history 7/week @ 2024-02-12 15/week @ 2024-02-19 32/week @ 2024-02-26 15/week @ 2024-03-04 16/week @ 2024-03-11 9/week @ 2024-03-18 27/week @ 2024-03-25 55/week @ 2024-04-01

111 downloads per month
Used in 6 crates (via inkpad-seal)

MIT license

8KB
151 lines

Inkpad Derive

crate doc downloads LICENSE

Procedural macros for inkpad

#[host(module)]

#[host(seal0)]
fn seal_input(out_ptr: u32, out_len_ptr: u32) -> Result<ReturnValue>;
struct SealInput;

impl Host for SealInput {
    fn module() -> &'static str {
        "seal0"
    }
    
    fn name() -> &'static str {
        "seal_input"
    }
    
    fn wrap() -> HostFuncType<Sandbox> {
        fn(sandbox: &mut Sandbox, args: &[Value]) -> Result<ReturnValue> {
            if args.len() != 2 {
                return Err(Error::WrongArugmentLength);
            }
            
            let [out_ptr, out_len_ptr] = [args[0].into(), args[1].into()];
            seal_input(sandbox, out_ptr, out_len_ptr)
        }
    }
    
    /// Pack instance
    fn pack() -> (&'static str, &'static str, HostFuncType<Sandbox>) {
        (
            <Self as Host>::module(),
            <Self as Host>::name(),
            <Self as Host>::wrap,
        )
    }
}

LICNESE

MIT

Dependencies

~1.5MB
~34K SLoC