Struct ethp2p::ProtocolMessage
source · [−]pub struct ProtocolMessage {
pub message_type: EthMessageID,
pub message: EthMessage,
}
Expand description
An eth
protocol message, containing a message ID and payload.
Fields
message_type: EthMessageID
message: EthMessage
Implementations
sourceimpl ProtocolMessage
impl ProtocolMessage
sourcepub fn decode_message(
message_type: EthMessageID,
buf: &mut &[u8]
) -> Result<Self, DecodeError>
pub fn decode_message(
message_type: EthMessageID,
buf: &mut &[u8]
) -> Result<Self, DecodeError>
Create a new ProtocolMessage from a message type and message rlp bytes.
Trait Implementations
sourceimpl Clone for ProtocolMessage
impl Clone for ProtocolMessage
sourcefn clone(&self) -> ProtocolMessage
fn clone(&self) -> ProtocolMessage
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for ProtocolMessage
impl Debug for ProtocolMessage
sourceimpl Decodable for ProtocolMessage
impl Decodable for ProtocolMessage
Decodes a protocol message from bytes, using the first byte to determine the message type.
This decodes eth/66
request ids for each message type.
sourceimpl Encodable for ProtocolMessage
impl Encodable for ProtocolMessage
Encodes the protocol message into bytes. The message type is encoded as a single byte and prepended to the message.
sourceimpl From<EthMessage> for ProtocolMessage
impl From<EthMessage> for ProtocolMessage
sourcefn from(message: EthMessage) -> Self
fn from(message: EthMessage) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<ProtocolMessage> for ProtocolMessage
impl PartialEq<ProtocolMessage> for ProtocolMessage
sourcefn eq(&self, other: &ProtocolMessage) -> bool
fn eq(&self, other: &ProtocolMessage) -> bool
impl Eq for ProtocolMessage
impl StructuralEq for ProtocolMessage
impl StructuralPartialEq for ProtocolMessage
Auto Trait Implementations
impl RefUnwindSafe for ProtocolMessage
impl Send for ProtocolMessage
impl Sync for ProtocolMessage
impl Unpin for ProtocolMessage
impl UnwindSafe for ProtocolMessage
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more