Enum cosmwasm_std::SystemResult [−][src]
pub enum SystemResult<S> { Ok(S), Err(SystemError), }
Expand description
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
Err(SystemError)
Implementations
Converts a ContractResult<S>
to a Result<S, SystemError>
as a convenient way
to access the full Result API.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
Performs the conversion.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<S> RefUnwindSafe for SystemResult<S> where
S: RefUnwindSafe,
impl<S> Send for SystemResult<S> where
S: Send,
impl<S> Sync for SystemResult<S> where
S: Sync,
impl<S> Unpin for SystemResult<S> where
S: Unpin,
impl<S> UnwindSafe for SystemResult<S> where
S: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self