warp_contracts_core::handler_result

Enum ViewResult

Source
pub enum ViewResult<View, Error> {
    Success(View),
    ContractError(Error),
    RuntimeError(String),
}
Expand description

Return type for ‘view’ contract method

User is responsible for providing View and Error types. To use them with #[warp_contract(view)] macro they both have to implement Debug and Serialize. This allows passing them from rust to js.

Variants§

§

Success(View)

returned on success - View contains the result

§

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§

Source§

impl<View: Debug, Error: Debug> Debug for ViewResult<View, Error>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<View, Error> Freeze for ViewResult<View, Error>
where View: Freeze, Error: Freeze,

§

impl<View, Error> RefUnwindSafe for ViewResult<View, Error>
where View: RefUnwindSafe, Error: RefUnwindSafe,

§

impl<View, Error> Send for ViewResult<View, Error>
where View: Send, Error: Send,

§

impl<View, Error> Sync for ViewResult<View, Error>
where View: Sync, Error: Sync,

§

impl<View, Error> Unpin for ViewResult<View, Error>
where View: Unpin, Error: Unpin,

§

impl<View, Error> UnwindSafe for ViewResult<View, Error>
where View: UnwindSafe, Error: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.