pub struct EthStreamInner<N> { /* private fields */ }Expand description
Contains eth protocol specific logic for processing messages
Implementations§
Source§impl<N> EthStreamInner<N>where
N: NetworkPrimitives,
impl<N> EthStreamInner<N>where
N: NetworkPrimitives,
Sourcepub const fn new(version: EthVersion) -> Self
pub const fn new(version: EthVersion) -> Self
Creates a new EthStreamInner with the given eth version
Sourcepub const fn with_max_message_size(
version: EthVersion,
max_message_size: usize,
) -> Self
pub const fn with_max_message_size( version: EthVersion, max_message_size: usize, ) -> Self
Creates a new EthStreamInner with the given eth version and message size limit.
Sourcepub const fn version(&self) -> EthVersion
pub const fn version(&self) -> EthVersion
Returns the eth version
Sourcepub const fn set_reject_block_announcements(&mut self, reject: bool)
pub const fn set_reject_block_announcements(&mut self, reject: bool)
Sets whether to reject block announcement messages (NewBlock, NewBlockHashes) before
RLP decoding.
Sourcepub fn decode_message(
&mut self,
bytes: BytesMut,
) -> Result<EthMessage<N>, EthStreamError>
pub fn decode_message( &mut self, bytes: BytesMut, ) -> Result<EthMessage<N>, EthStreamError>
Decodes incoming bytes into an EthMessage.
A response is only decoded if it answers a request sent through Self::encode_message
and carries at most as many items as that request asked for, see
EthStreamError::UnsolicitedResponse and EthStreamError::ResponseExceedsRequest.
Sourcepub fn encode_message(
&mut self,
item: EthMessage<N>,
) -> Result<Bytes, EthStreamError>
pub fn encode_message( &mut self, item: EthMessage<N>, ) -> Result<Bytes, EthStreamError>
Encodes an EthMessage to bytes.
Validates that Status messages are not sent after handshake, enforcing protocol rules.
Requests are recorded so that Self::decode_message accepts their responses.
Trait Implementations§
Auto Trait Implementations§
impl<N> Freeze for EthStreamInner<N>where
PhantomData<N>: Freeze,
impl<N> RefUnwindSafe for EthStreamInner<N>where
PhantomData<N>: RefUnwindSafe,
impl<N> Send for EthStreamInner<N>where
PhantomData<N>: Send,
impl<N> Sync for EthStreamInner<N>where
PhantomData<N>: Sync,
impl<N> Unpin for EthStreamInner<N>where
PhantomData<N>: Unpin,
impl<N> UnsafeUnpin for EthStreamInner<N>where
PhantomData<N>: UnsafeUnpin,
impl<N> UnwindSafe for EthStreamInner<N>where
PhantomData<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
§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 more§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: 40 bytes