Derive Macro Storage

Source
#[derive(Storage)]
{
    // Attributes available to this derive:
    #[inc_complete]
}
Expand description

Derive macro for Storage trait

Usage:

#[derive(Storage)]
struct MyStorage {
    numbers: SingletonStorage<Number>,
    strings: HashMapStorage<StringComputation>,
}

This generates a call to impl_storage!(MyStorage, numbers: Number, strings: StringComputation) which provides the actual implementation.

ยงSkip Attribute

Fields can be excluded from the Storage implementation using #[inc_complete(skip)]:

#[derive(Storage)]
struct MyStorage {
    numbers: SingletonStorage<Number>,

    #[inc_complete(skip)]
    metadata: String,  // This field won't be included in Storage implementation
}

# Computation Attribute

The computation type for a field can be manually specified using `#[inc_complete(computation = Type)]`.
This is required if the field type is not already generic over the computation type. For
example, `HashMapStorage<MyComputationType>` is generic over `MyComputationType` but
`MyStringStorage` is not:

```rust
#[derive(Storage)]
struct MyStorage {
    numbers: SingletonStorage<Number>,

    #[inc_complete(computation = MyStringInput)]
    strings: MyStringStorage,
}