Struct concordium_std::ContractName
source · pub struct ContractName<'a>(_);
Expand description
A contract name. Expected format: “init_<contract_name>”.
Implementations§
source§impl<'a> ContractName<'a>
impl<'a> ContractName<'a>
sourcepub fn new(name: &'a str) -> Result<ContractName<'a>, NewContractNameError>
pub fn new(name: &'a str) -> Result<ContractName<'a>, NewContractNameError>
Create a new ContractName and check the format. Expected format: “init_<contract_name>”.
sourcepub fn new_unchecked(name: &'a str) -> ContractName<'a>
pub fn new_unchecked(name: &'a str) -> ContractName<'a>
Create a new ContractName without checking the format. Expected format: “init_<contract_name>”. If this precondition is not satisfied then the behaviour of any methods on this type is unspecified, and may include panics.
sourcepub fn get_chain_name(self) -> &'a str
pub fn get_chain_name(self) -> &'a str
Get contract name used on chain: “init_<contract_name>”.
sourcepub fn contract_name(self) -> &'a str
pub fn contract_name(self) -> &'a str
Extract the contract name by removing the “init_” prefix.
sourcepub fn is_valid_contract_name(name: &str) -> Result<(), NewContractNameError>
pub fn is_valid_contract_name(name: &str) -> Result<(), NewContractNameError>
Check whether the given string is a valid contract initialization function name. This is the case if and only if
- the string is no more than constants::MAX_FUNC_NAME_SIZE bytes
- the string starts with
init_
- the string does not contain a
.
- all characters are ascii alphanumeric or punctuation characters.
Trait Implementations§
source§impl<'a> Clone for ContractName<'a>
impl<'a> Clone for ContractName<'a>
source§fn clone(&self) -> ContractName<'a>
fn clone(&self) -> ContractName<'a>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<'a> Debug for ContractName<'a>
impl<'a> Debug for ContractName<'a>
source§impl<'a> Display for ContractName<'a>
impl<'a> Display for ContractName<'a>
source§impl<'a> From<ContractName<'a>> for &'a str
impl<'a> From<ContractName<'a>> for &'a str
source§fn from(n: ContractName<'a>) -> &'a str
fn from(n: ContractName<'a>) -> &'a str
Converts to this type from the input type.
source§impl<'a> Hash for ContractName<'a>
impl<'a> Hash for ContractName<'a>
source§impl<'a> PartialEq<ContractName<'a>> for ContractName<'a>
impl<'a> PartialEq<ContractName<'a>> for ContractName<'a>
source§fn eq(&self, other: &ContractName<'a>) -> bool
fn eq(&self, other: &ContractName<'a>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.