define_input

Macro define_input 

Source
macro_rules! define_input {
    ( $id:tt, $type_name:ident -> $output_type:ty, $( $storage_type:ty )|+ ) => { ... };
    ( $id:tt, assume_changed $type_name:ident -> $output_type:ty, $( $storage_type:ty )|+ ) => { ... };
    (@ $id:tt, $type_name:ident -> $output_type:ty, $assume_changed:expr, $( $storage_type:ty )|+ ) => { ... };
}
Expand description

Helper macro to define an input computation type. This will implement OutputType, ComputationId, and Run. Note that the Run implementation will panic by default with a message that update_input should have been called beforehand.

This macro supports multiple Storage types used, separated by |, in case your program uses multiple databases with differing storage types.

Signature: define_input!(computation_id, ComputationType -> OutputType, StorageType ( | MoreStorageTypes)* )

Example usage:

#[derive(Clone)]
struct MyInput;

// Define `MyInput` as an input computation with id 0 and an `i32` value
// which can be used with a `Db<MyStorageType>`.
define_input!(0, MyInput -> i32, MyStorageType);