Trait ContractName
pub trait ContractName {
const NAME: &'static str;
}
Expand description
Stores the name of the ink! smart contract.
§Note
The name is the identifier of the #[ink(storage)]
annotated struct
.
§Usage
#[ink::contract]
pub mod contract {
#[ink(storage)]
pub struct Contract {}
impl Contract {
#[ink(constructor)]
pub fn constructor() -> Self {
Self {}
}
#[ink(message)]
pub fn message(&self) {}
}
}
use contract::Contract;
assert_eq!(<Contract as ContractName>::NAME, "Contract",);
Required Associated Constants§
Object Safety§
This trait is not object safe.