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 to_owned(&self) -> OwnedContractName
pub fn to_owned(&self) -> OwnedContractName
Convert a ContractName
to its owned counterpart. This is an
expensive operation that requires memory allocation.
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<&'a str> for ContractName<'a>
impl<'a> PartialEq<&'a str> 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 ==
.source§impl<'a> PartialEq<str> for ContractName<'a>
impl<'a> PartialEq<str> for ContractName<'a>
source§impl<'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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T, S> StateClone<S> for Twhere
T: Clone,
impl<T, S> StateClone<S> for Twhere T: Clone,
source§unsafe fn clone_state(&self, _cloned_state_api: &S) -> T
unsafe fn clone_state(&self, _cloned_state_api: &S) -> T
Make a clone of the type while using the
cloned_state_api
. Read more