pub struct OracleResponse {
pub response: OracleData,
pub timestamp: String,
}Expand description
The response received from an oracle.
This data structure is used to represent the successful output of an oracle request.
Fields§
§response: OracleDataThe raw response data from the oracle, encoded as bytes.
timestamp: StringThe timestamp when the oracle response was generated.
Implementations§
Source§impl OracleResponse
impl OracleResponse
Sourcepub fn new(response: OracleData) -> Self
pub fn new(response: OracleData) -> Self
Creates a new OracleResponse with the given response data and timestamp.
Sourcepub fn into_successful_responses(self) -> Vec<Vec<u8>>
pub fn into_successful_responses(self) -> Vec<Vec<u8>>
Convert to successful response data. In case of OracleData::Raw returns a vector of one
element containing the raw bytes. In case of OracleData::Filtered returns a vector of all
successful filtered bytes.
If there are no successful responses, returns an empty vector.
Trait Implementations§
Source§impl BorshDeserialize for OracleResponse
impl BorshDeserialize for OracleResponse
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 OracleResponse
impl BorshSerialize for OracleResponse
Source§impl Clone for OracleResponse
impl Clone for OracleResponse
Source§fn clone(&self) -> OracleResponse
fn clone(&self) -> OracleResponse
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 OracleResponse
impl Debug for OracleResponse
Source§impl<'de> Deserialize<'de> for OracleResponse
impl<'de> Deserialize<'de> for OracleResponse
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 HumanReadable for OracleResponse
impl HumanReadable for OracleResponse
Source§fn human_readable(&self) -> String
fn human_readable(&self) -> String
Return a human-readable string representation
Source§impl PartialEq for OracleResponse
impl PartialEq for OracleResponse
Source§impl Serialize for OracleResponse
impl Serialize for OracleResponse
impl Eq for OracleResponse
impl Representable for OracleResponse
impl StructuralPartialEq for OracleResponse
Auto Trait Implementations§
impl Freeze for OracleResponse
impl RefUnwindSafe for OracleResponse
impl Send for OracleResponse
impl Sync for OracleResponse
impl Unpin for OracleResponse
impl UnsafeUnpin for OracleResponse
impl UnwindSafe for OracleResponse
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.