#[non_exhaustive]pub enum OracleOutput {
Success(OracleResponse),
OracleError(OracleError),
UnserializableResponse(String),
}Expand description
The output from an oracle.
This enum represents the possible outcomes of an oracle execution.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Success(OracleResponse)
The response of a successfully handled oracle request.
OracleError(OracleError)
The details of an error reported by an oracle.
UnserializableResponse(String)
The oracle output an unserializable response.
Implementations§
Source§impl OracleOutput
impl OracleOutput
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Returns true if the output is a success.
Sourcepub fn is_oracle_error(&self) -> bool
pub fn is_oracle_error(&self) -> bool
Returns true if the output is an oracle error.
Sourcepub fn is_unserializable_response(&self) -> bool
pub fn is_unserializable_response(&self) -> bool
Returns true if the output is an unserializable response.
Sourcepub fn as_success(&self) -> Option<&OracleResponse>
pub fn as_success(&self) -> Option<&OracleResponse>
Returns the contained OracleResponse if the output is a success, otherwise returns None.
Sourcepub fn as_oracle_error(&self) -> Option<&OracleError>
pub fn as_oracle_error(&self) -> Option<&OracleError>
Returns the contained OracleError if the output is an oracle error, otherwise returns None.
Trait Implementations§
Source§impl BorshDeserialize for OracleOutput
impl BorshDeserialize for OracleOutput
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for OracleOutput
impl BorshSerialize for OracleOutput
Source§impl Clone for OracleOutput
impl Clone for OracleOutput
Source§fn clone(&self) -> OracleOutput
fn clone(&self) -> OracleOutput
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OracleOutput
impl Debug for OracleOutput
Source§impl<'de> Deserialize<'de> for OracleOutput
impl<'de> Deserialize<'de> for OracleOutput
Source§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
Source§impl EnumExt for OracleOutput
impl EnumExt for OracleOutput
Source§impl From<OracleError> for OracleOutput
impl From<OracleError> for OracleOutput
Source§fn from(error: OracleError) -> Self
fn from(error: OracleError) -> Self
Converts to this type from the input type.
Source§impl From<Result<OracleResponse, OracleError>> for OracleOutput
impl From<Result<OracleResponse, OracleError>> for OracleOutput
Source§fn from(result: Result<OracleResponse, OracleError>) -> Self
fn from(result: Result<OracleResponse, OracleError>) -> Self
Converts to this type from the input type.
Source§impl HumanReadable for OracleOutput
impl HumanReadable for OracleOutput
Source§fn human_readable(&self) -> String
fn human_readable(&self) -> String
Return a human-readable string representation
Source§impl PartialEq for OracleOutput
impl PartialEq for OracleOutput
Source§impl Serialize for OracleOutput
impl Serialize for OracleOutput
impl Eq for OracleOutput
impl Representable for OracleOutput
impl StructuralPartialEq for OracleOutput
Auto Trait Implementations§
impl Freeze for OracleOutput
impl RefUnwindSafe for OracleOutput
impl Send for OracleOutput
impl Sync for OracleOutput
impl Unpin for OracleOutput
impl UnsafeUnpin for OracleOutput
impl UnwindSafe for OracleOutput
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.