#[non_exhaustive]pub struct ViewResult {
pub result: Vec<u8>,
pub logs: Vec<String>,
}Expand description
The result from a call into a View function. This contains the contents or the results from the view function call itself. The consumer of this object can choose how to deserialize its contents.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.result: Vec<u8>Our result from our call into a view function.
logs: Vec<String>Logs generated from the view function.
Implementations§
source§impl ViewResult
impl ViewResult
sourcepub fn json<T: DeserializeOwned>(&self) -> Result<T>
pub fn json<T: DeserializeOwned>(&self) -> Result<T>
Deserialize an instance of type T from bytes of JSON text sourced from the
execution result of this call. This conversion can fail if the structure of
the internal state does not meet up with serde::de::DeserializeOwned’s
requirements.
sourcepub fn borsh<T: BorshDeserialize>(&self) -> Result<T>
pub fn borsh<T: BorshDeserialize>(&self) -> Result<T>
Deserialize an instance of type T from bytes sourced from this view call’s
result. This conversion can fail if the structure of the internal state does
not meet up with borsh::BorshDeserialize’s requirements.
Trait Implementations§
source§impl Clone for ViewResult
impl Clone for ViewResult
source§fn clone(&self) -> ViewResult
fn clone(&self) -> ViewResult
Returns a copy 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 ViewResult
impl Debug for ViewResult
source§impl From<CallResult> for ViewResult
impl From<CallResult> for ViewResult
source§fn from(result: CallResult) -> Self
fn from(result: CallResult) -> Self
Converts to this type from the input type.
source§impl PartialEq for ViewResult
impl PartialEq for ViewResult
impl Eq for ViewResult
impl StructuralPartialEq for ViewResult
Auto Trait Implementations§
impl Freeze for ViewResult
impl RefUnwindSafe for ViewResult
impl Send for ViewResult
impl Sync for ViewResult
impl Unpin for ViewResult
impl UnwindSafe for ViewResult
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more