pub struct ViewCallBorsh<T> { /* private fields */ }Expand description
Query builder for view functions with Borsh deserialization.
Created by calling .borsh() on a ViewCall.
This variant deserializes the response as Borsh instead of JSON.
§Example
use near_kit::*;
use borsh::BorshDeserialize;
#[derive(BorshDeserialize)]
struct ContractState { count: u64 }
#[derive(borsh::BorshSerialize)]
struct MyArgs { key: u64 }
async fn example() -> Result<(), near_kit::Error> {
let near = Near::testnet().build();
// JSON args, Borsh response
let state: ContractState = near.view("contract.testnet", "get_state")
.args(serde_json::json!({ "key": "value" }))
.borsh()
.await?;
// Borsh args, Borsh response
let state: ContractState = near.view("contract.testnet", "get_state")
.args_borsh(MyArgs { key: 123 })
.borsh()
.await?;
Ok(())
}Trait Implementations§
Source§impl<T: BorshDeserialize + Send + 'static> IntoFuture for ViewCallBorsh<T>
impl<T: BorshDeserialize + Send + 'static> IntoFuture for ViewCallBorsh<T>
Source§type IntoFuture = Pin<Box<dyn Future<Output = <ViewCallBorsh<T> as IntoFuture>::Output> + Send>>
type IntoFuture = Pin<Box<dyn Future<Output = <ViewCallBorsh<T> as IntoFuture>::Output> + Send>>
Which kind of future are we turning this into?
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Creates a future from a value. Read more
Auto Trait Implementations§
impl<T> Freeze for ViewCallBorsh<T>
impl<T> !RefUnwindSafe for ViewCallBorsh<T>
impl<T> Send for ViewCallBorsh<T>where
T: Send,
impl<T> Sync for ViewCallBorsh<T>where
T: Sync,
impl<T> Unpin for ViewCallBorsh<T>where
T: Unpin,
impl<T> UnsafeUnpin for ViewCallBorsh<T>
impl<T> !UnwindSafe for ViewCallBorsh<T>
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