Struct concordium_contracts_common::ContractName
source · [−]pub struct ContractName<'a>(_);
Expand description
A contract name. Expected format: “init_<contract_name>”.
Implementations
sourceimpl<'a> ContractName<'a>
impl<'a> ContractName<'a>
sourcepub fn new(name: &'a str) -> Result<Self, NewContractNameError>
pub fn new(name: &'a str) -> Result<Self, NewContractNameError>
Create a new ContractName and check the format. Expected format: “init_<contract_name>”.
sourcepub fn new_unchecked(name: &'a str) -> Self
pub fn new_unchecked(name: &'a str) -> Self
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
sourceimpl<'a> Clone for ContractName<'a>
impl<'a> Clone for ContractName<'a>
sourcefn clone(&self) -> ContractName<'a>
fn clone(&self) -> ContractName<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a> Debug for ContractName<'a>
impl<'a> Debug for ContractName<'a>
sourceimpl<'a> From<ContractName<'a>> for &'a str
impl<'a> From<ContractName<'a>> for &'a str
sourcefn from(n: ContractName<'a>) -> Self
fn from(n: ContractName<'a>) -> Self
Converts to this type from the input type.
sourceimpl<'a> Hash for ContractName<'a>
impl<'a> Hash for ContractName<'a>
sourceimpl<'a> PartialEq<ContractName<'a>> for ContractName<'a>
impl<'a> PartialEq<ContractName<'a>> for ContractName<'a>
sourcefn 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 ==
. Read more
sourceimpl<'a> Serial for ContractName<'a>
impl<'a> Serial for ContractName<'a>
impl<'a> Copy for ContractName<'a>
impl<'a> Eq for ContractName<'a>
impl<'a> StructuralEq for ContractName<'a>
impl<'a> StructuralPartialEq for ContractName<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for ContractName<'a>
impl<'a> Send for ContractName<'a>
impl<'a> Sync for ContractName<'a>
impl<'a> Unpin for ContractName<'a>
impl<'a> UnwindSafe for ContractName<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more