alloy_json_rpc

Struct SerializedRequest

source
pub struct SerializedRequest { /* private fields */ }
Expand description

A JSON-RPC 2.0 request object that has been serialized, with its Id and method preserved.

This struct is used to represent a request that has been serialized, but not yet sent. It is used by RPC clients to build batch requests and manage in-flight requests.

Implementations§

source§

impl SerializedRequest

source

pub const fn meta(&self) -> &RequestMeta

Returns the request metadata (ID and Method).

source

pub const fn id(&self) -> &Id

Returns the request ID.

source

pub fn method(&self) -> &str

Returns the request method.

source

pub fn set_is_subscription(&mut self)

Mark the request as a non-standard subscription (i.e. not eth_subscribe)

source

pub fn is_subscription(&self) -> bool

Returns true if the request is a subscription.

source

pub const fn serialized(&self) -> &RawValue

Returns the serialized request.

source

pub fn into_serialized(self) -> Box<RawValue>

Consume the serialized request, returning the underlying RawValue.

source

pub fn decompose(self) -> (RequestMeta, Box<RawValue>)

Consumes the serialized request, returning the underlying RequestMeta and the RawValue.

source

pub fn take_request(self) -> Box<RawValue>

Take the serialized request, consuming the SerializedRequest.

source

pub fn params(&self) -> Option<&RawValue>

Get a reference to the serialized request’s params.

This partially deserializes the request, and should be avoided if possible.

source

pub fn params_hash(&self) -> B256

Get the hash of the serialized request’s params.

This partially deserializes the request, and should be avoided if possible.

Trait Implementations§

source§

impl Clone for SerializedRequest

source§

fn clone(&self) -> SerializedRequest

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SerializedRequest

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<SerializedRequest> for RequestPacket

source§

fn from(req: SerializedRequest) -> Self

Converts to this type from the input type.
source§

impl FromIterator<SerializedRequest> for RequestPacket

source§

fn from_iter<T: IntoIterator<Item = SerializedRequest>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl Serialize for SerializedRequest

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<Params> TryFrom<Request<Params>> for SerializedRequest
where Params: RpcParam,

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Request<Params>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> RpcParam for T
where T: Serialize + Clone + Debug + Send + Sync + Unpin,