Struct concordium_std::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<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
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> 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
sourcefn ne(&self, other: &ContractName<'a>) -> bool
fn ne(&self, other: &ContractName<'a>) -> bool
This method tests for !=.
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more