pub enum WriteResult<State, Error> {
Success(State),
ContractError(Error),
RuntimeError(String),
}Expand description
Return type for ‘write’ contract method
User is responsible for providing State and Error types. To use them with #[warp_contract(write)] macro State
have to implement:
Clone- to allow safe passing of a clone of state to contract method and disallow partial state changes in case an error is returnedSerialize,Deserialize- to pass it both ways between js and rust andErrorhave to implementSerialize.
Both types have to implement Debug to allow generic error message creation.
Variants§
Success(State)
returned on success - State contains the updated contract state
ContractError(Error)
returned when a ‘business’ error occurred, The user-defined Error parameter is returned to the caller.
RuntimeError(String)
returned when an unexpected error occurred, The String parameter is for debugging purposes
Trait Implementations§
Auto Trait Implementations§
impl<State, Error> Freeze for WriteResult<State, Error>
impl<State, Error> RefUnwindSafe for WriteResult<State, Error>where
State: RefUnwindSafe,
Error: RefUnwindSafe,
impl<State, Error> Send for WriteResult<State, Error>
impl<State, Error> Sync for WriteResult<State, Error>
impl<State, Error> Unpin for WriteResult<State, Error>
impl<State, Error> UnwindSafe for WriteResult<State, Error>where
State: UnwindSafe,
Error: UnwindSafe,
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