[][src]Enum cosmwasm_std::SystemResult

pub enum SystemResult<S> {
    Ok(S),
    Err(SystemError),
}

This is the outer result type returned by a querier to the contract.

We use a custom type here instead of Rust's Result because we want to be able to define the serialization, which is a public interface. Every language that compiles to Wasm and runs in the ComsWasm VM needs to create the same JSON representation.

Examples

Success:

let data = Binary::from(b"hello, world");
let result = SystemResult::Ok(ContractResult::Ok(data));
assert_eq!(to_vec(&result).unwrap(), br#"{"ok":{"ok":"aGVsbG8sIHdvcmxk"}}"#.to_vec());

Failure:

let error = SystemError::Unknown {};
let result: SystemResult<Binary> = SystemResult::Err(error);
assert_eq!(to_vec(&result).unwrap(), br#"{"error":{"unknown":{}}}"#.to_vec());

Variants

Ok(S)

Implementations

impl<S> SystemResult<S>[src]

pub fn into_result(self) -> Result<S, SystemError>[src]

Converts a ContractResult<S> to a Result<S, SystemError> as a convenient way to access the full Result API.

pub fn unwrap(self) -> S[src]

impl<S: Debug> SystemResult<S>[src]

Trait Implementations

impl<S: Clone> Clone for SystemResult<S>[src]

impl<S: Debug> Debug for SystemResult<S>[src]

impl<'de, S> Deserialize<'de> for SystemResult<S> where
    S: Deserialize<'de>, 
[src]

impl<S> From<Result<S, SystemError>> for SystemResult<S>[src]

impl<S: JsonSchema> JsonSchema for SystemResult<S>[src]

impl<S: PartialEq> PartialEq<SystemResult<S>> for SystemResult<S>[src]

impl<S> Serialize for SystemResult<S> where
    S: Serialize
[src]

impl<S> StructuralPartialEq for SystemResult<S>[src]

Auto Trait Implementations

impl<S> RefUnwindSafe for SystemResult<S> where
    S: RefUnwindSafe
[src]

impl<S> Send for SystemResult<S> where
    S: Send
[src]

impl<S> Sync for SystemResult<S> where
    S: Sync
[src]

impl<S> Unpin for SystemResult<S> where
    S: Unpin
[src]

impl<S> UnwindSafe for SystemResult<S> where
    S: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.