Struct concordium_std::ParseError
source · [−]pub struct ParseError {}
Expand description
Zero-sized type to represent an error when reading bytes and deserializing.
When using custom error types in your smart contract, it is convenient to
implement the trait From<ParseError>
for you custom error type, to allow
using the ?
operator when deserializing bytes, such as the contract state
or parameters.
ⓘ
enum MyCustomReceiveError {
Parsing
}
impl From<ParseError> for MyCustomReceiveError {
fn from(_: ParseError) -> Self { MyCustomReceiveError::Parsing }
}
#[receive(contract = "mycontract", name="some_receive_name", mutable)]
fn contract_receive<S: HasStateApi>(
ctx: &impl HasReceiveContext,
host: &mut impl HasHost<State, StateApiType = S>,
) -> Result<A, MyCustomReceiveError> {
// ...
let msg: MyParameterType = ctx.parameter_cursor().get()?;
// ...
}
Trait Implementations
sourceimpl Debug for ParseError
impl Debug for ParseError
sourceimpl Default for ParseError
impl Default for ParseError
sourcefn default() -> ParseError
fn default() -> ParseError
Returns the “default value” for a type. Read more
sourceimpl From<ParseError> for Reject
impl From<ParseError> for Reject
Mapped to i32::MIN + 2.
sourcefn from(_: ParseError) -> Self
fn from(_: ParseError) -> Self
Converts to this type from the input type.
sourceimpl From<TestStateError> for ParseError
impl From<TestStateError> for ParseError
sourcefn from(_: TestStateError) -> Self
fn from(_: TestStateError) -> Self
Converts to this type from the input type.
sourceimpl From<TryFromIntError> for ParseError
impl From<TryFromIntError> for ParseError
sourcefn from(TryFromIntError) -> ParseError
fn from(TryFromIntError) -> ParseError
Converts to this type from the input type.
sourceimpl PartialEq<ParseError> for ParseError
impl PartialEq<ParseError> for ParseError
impl Eq for ParseError
impl StructuralEq for ParseError
impl StructuralPartialEq for ParseError
Auto Trait Implementations
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnwindSafe for ParseError
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