Derive Macro PanicOnDefault

Source
#[derive(PanicOnDefault)]
Expand description

PanicOnDefault generates implementation for Default trait that panics with the following message The contract is not initialized when default() is called. This is a helpful macro in case the contract is required to be initialized with either init or init(rust_state)

ยงExample

use near_sdk::{PanicOnDefault, near};

#[near(contract_state)]
#[derive(PanicOnDefault)]
pub struct Contract {
    pub name: String,
}