Skip to content

Allow enum to implement SpreadAllocate #1042

@forgetso

Description

@forgetso

Recently, the contract implementation style has changed so that the contract struct derives SpreadAllocate.

This causes a compilation error in contracts that make use of enum with more than one variant. This is because it is not possible to determine a default value, so SpreadAllocate is not defined for enum.

It would be nice if enum was allowed if the Default trait was implemented.

e.g. https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=21d9e01c332a660d9e5ab22634250f1a

Here is my hacked version of making this work in ink: prosopo@bdc676d

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions