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,