pub struct ProtocolMessage<N: NetworkPrimitives = EthNetworkPrimitives> {
pub message_type: EthMessageID,
pub message: EthMessage<N>,
}Expand description
An eth protocol message, containing a message ID and payload.
Fields§
§message_type: EthMessageIDThe unique identifier representing the type of the Ethereum message.
message: EthMessage<N>The content of the message, including specific data based on the message type.
Implementations§
Source§impl<N: NetworkPrimitives> ProtocolMessage<N>
impl<N: NetworkPrimitives> ProtocolMessage<N>
Sourcepub fn decode_status(
version: EthVersion,
buf: &mut &[u8],
) -> Result<StatusMessage, MessageError>
pub fn decode_status( version: EthVersion, buf: &mut &[u8], ) -> Result<StatusMessage, MessageError>
Decode only a Status message from RLP bytes.
This is used during the eth handshake where only a Status message is a valid response. Returns an error if the message is not a Status message.
Sourcepub fn decode_message(
version: EthVersion,
buf: &mut &[u8],
) -> Result<Self, MessageError>
pub fn decode_message( version: EthVersion, buf: &mut &[u8], ) -> Result<Self, MessageError>
Create a new ProtocolMessage from a message type and message rlp bytes.
This will enforce decoding according to the given EthVersion of the connection.
Sourcepub fn decode_message_with_tx_memory_budget(
version: EthVersion,
buf: &mut &[u8],
tx_memory_budget: usize,
) -> Result<Self, MessageError>
pub fn decode_message_with_tx_memory_budget( version: EthVersion, buf: &mut &[u8], tx_memory_budget: usize, ) -> Result<Self, MessageError>
Like Self::decode_message, but caps the cumulative in-memory size of decoded
transactions in Transactions and PooledTransactions messages. Once exceeded,
remaining transactions are silently dropped.
Use TX_MEMORY_BUDGET_MULTIPLIER to derive a reasonable default.
Trait Implementations§
Source§impl<N: Clone + NetworkPrimitives> Clone for ProtocolMessage<N>
impl<N: Clone + NetworkPrimitives> Clone for ProtocolMessage<N>
Source§impl<N: Debug + NetworkPrimitives> Debug for ProtocolMessage<N>
impl<N: Debug + NetworkPrimitives> Debug for ProtocolMessage<N>
Source§impl<'de, N: NetworkPrimitives> Deserialize<'de> for ProtocolMessage<N>
Available on crate feature serde only.
impl<'de, N: NetworkPrimitives> Deserialize<'de> for ProtocolMessage<N>
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<N: NetworkPrimitives> Encodable for ProtocolMessage<N>
impl<N: NetworkPrimitives> Encodable for ProtocolMessage<N>
impl<N: Eq + NetworkPrimitives> Eq for ProtocolMessage<N>
Source§impl<N: NetworkPrimitives> From<EthMessage<N>> for ProtocolMessage<N>
impl<N: NetworkPrimitives> From<EthMessage<N>> for ProtocolMessage<N>
Source§fn from(message: EthMessage<N>) -> Self
fn from(message: EthMessage<N>) -> Self
Source§impl<N: PartialEq + NetworkPrimitives> PartialEq for ProtocolMessage<N>
impl<N: PartialEq + NetworkPrimitives> PartialEq for ProtocolMessage<N>
Source§impl<N: NetworkPrimitives> Serialize for ProtocolMessage<N>
Available on crate feature serde only.
impl<N: NetworkPrimitives> Serialize for ProtocolMessage<N>
serde only.impl<N: PartialEq + NetworkPrimitives> StructuralPartialEq for ProtocolMessage<N>
Auto Trait Implementations§
impl<N = BasicNetworkPrimitives<EthPrimitives, EthereumTxEnvelope<TxEip4844WithSidecar>>> !Freeze for ProtocolMessage<N>
impl<N> RefUnwindSafe for ProtocolMessage<N>where
EthMessage<N>: RefUnwindSafe,
impl<N> Send for ProtocolMessage<N>where
EthMessage<N>: Send,
impl<N> Sync for ProtocolMessage<N>where
EthMessage<N>: Sync,
impl<N> Unpin for ProtocolMessage<N>where
EthMessage<N>: Unpin,
impl<N> UnsafeUnpin for ProtocolMessage<N>where
EthMessage<N>: UnsafeUnpin,
impl<N> UnwindSafe for ProtocolMessage<N>where
EthMessage<N>: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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 moreimpl<T> MaybeSerde for Twhere
T: Serialize + for<'de> Deserialize<'de>,
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 144 bytes