[−][src]Struct networking::BitcoinCodec
A Codec converting a raw TcpStream into a Sink + Stream of Bitcoin Wire Protocol Message
s.
This struct handles the serialization and sending of Message
s. Callers simply construct a Framed
instance containing the codec and the TcpStream.
// Note: This example does not compile outside the context of an async runtime. let connection = tokio::net::TcpStream::connect("127.0.0.1:8333".into()).await?; let codec = networking::BitcoinCodec::new(0); let connection = Framed::new(connection, codec); // Create and send a message. let msg = Message::Verack{}; connection.send(msg).await?; // Await the response. let response: Message = connection.next().await?;
Implementations
impl Codec
[src]
Trait Implementations
impl Debug for Codec
[src]
impl Decoder for Codec
[src]
type Error = DeserializationError
The type of unrecoverable frame decoding errors. Read more
type Item = Message
The type of decoded frames.
fn decode(
&mut self,
src: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
[src]
&mut self,
src: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
fn decode_eof(
&mut self,
buf: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
[src]
&mut self,
buf: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
fn framed<T>(self, io: T) -> Framed<T, Self> where
T: AsyncRead + AsyncWrite,
[src]
T: AsyncRead + AsyncWrite,
impl Encoder<Message> for Codec
[src]
Auto Trait Implementations
impl RefUnwindSafe for Codec
impl Send for Codec
impl Sync for Codec
impl Unpin for Codec
impl UnwindSafe for Codec
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,