2 unstable releases

0.2.0 Aug 2, 2021
0.1.0 Jun 14, 2021

#395 in #substrate

Download history 4/week @ 2024-02-12 10/week @ 2024-02-19 24/week @ 2024-02-26 10/week @ 2024-03-04 22/week @ 2024-03-11 10/week @ 2024-03-18 21/week @ 2024-03-25 61/week @ 2024-04-01 9/week @ 2024-04-08 24/week @ 2024-04-15

115 downloads per month
Used in 5 crates (via ceres-seal)

MIT license

8KB
150 lines

Ceres Derive

crate doc downloads LICENSE

Procedural macros for ceres

#[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
~33K SLoC