pub struct Provider<T: Target> { /* private fields */ }
Expand description
Generic provider for HTTP requests to a Target
. Handles construction, auth, and execution.
Implementations§
Source§impl<T> Provider<T>where
T: Target,
impl<T> Provider<T>where
T: Target,
Sourcepub fn new(
endpoint_fn: Option<EndpointFn<T>>,
request_fn: Option<RequestBuilderFn<T>>,
timeout: Option<Duration>,
) -> Self
pub fn new( endpoint_fn: Option<EndpointFn<T>>, request_fn: Option<RequestBuilderFn<T>>, timeout: Option<Duration>, ) -> Self
Creates a new Provider
with optional URL, request builder customization, and timeout.
pub fn with_client( client: Client, endpoint_fn: Option<EndpointFn<T>>, request_fn: Option<RequestBuilderFn<T>>, ) -> Self
pub fn request_url(&self, target: &T) -> String
Trait Implementations§
Source§impl<T> JsonProviderType<T> for Provider<T>
impl<T> JsonProviderType<T> for Provider<T>
Source§async fn request_json<U: DeserializeOwned>(&self, target: T) -> Result<U, Error>
async fn request_json<U: DeserializeOwned>(&self, target: T) -> Result<U, Error>
request and deserialize response to json using serde
Source§impl<T> JsonRpcProviderType<T> for Provider<T>where
T: JsonRpcTarget + Send,
impl<T> JsonRpcProviderType<T> for Provider<T>where
T: JsonRpcTarget + Send,
Source§async fn batch<U: DeserializeOwned>(
&self,
targets: Vec<T>,
) -> Result<Vec<JsonRpcResult<U>>, JsonRpcError>
async fn batch<U: DeserializeOwned>( &self, targets: Vec<T>, ) -> Result<Vec<JsonRpcResult<U>>, JsonRpcError>
batch isomorphic JSON-RPC requests
async fn batch_chunk_by<U: DeserializeOwned>( &self, targets: Vec<T>, chunk_size: usize, ) -> Result<Vec<JsonRpcResult<U>>, JsonRpcError>
Auto Trait Implementations§
impl<T> Freeze for Provider<T>
impl<T> !RefUnwindSafe for Provider<T>
impl<T> Send for Provider<T>
impl<T> Sync for Provider<T>
impl<T> Unpin for Provider<T>
impl<T> !UnwindSafe for Provider<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