pub enum ProtocolMessage {
ClientPreamble(ClientPreamble),
ServerPreamble(ServerPreamble),
ClientAuthentication(ClientAuthentication),
HandshakeCompletion,
Data(Vec<u8>),
UdpData(Vec<u8>),
Error(ProtocolError),
}Expand description
A helper type for protocol messages.
This is the main message type for the protocol. It is used to send and receive messages over the network. It is also used to serialize and deserialize messages.
Variants§
ClientPreamble(ClientPreamble)
ServerPreamble(ServerPreamble)
ClientAuthentication(ClientAuthentication)
HandshakeCompletion
Data(Vec<u8>)
UdpData(Vec<u8>)
Error(ProtocolError)
Implementations§
Source§impl ProtocolMessage
impl ProtocolMessage
Sourcepub fn fail_if_error(self) -> Res<Self>
pub fn fail_if_error(self) -> Res<Self>
Checks if the message is an error.
If it is, returns the message wrapped in an error.
Trait Implementations§
Source§impl Debug for ProtocolMessage
impl Debug for ProtocolMessage
Source§impl<'de> Deserialize<'de> for ProtocolMessage
impl<'de> Deserialize<'de> for ProtocolMessage
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ProtocolMessage
impl PartialEq for ProtocolMessage
Source§impl Serialize for ProtocolMessage
impl Serialize for ProtocolMessage
Source§impl<R, W> Sink<ProtocolMessage> for BuffedStream<R, W>
impl<R, W> Sink<ProtocolMessage> for BuffedStream<R, W>
Source§fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Attempts to prepare the
Sink to receive a value. Read moreSource§fn start_send(
self: Pin<&mut Self>,
item: ProtocolMessage,
) -> Result<(), Self::Error>
fn start_send( self: Pin<&mut Self>, item: ProtocolMessage, ) -> Result<(), Self::Error>
Begin the process of sending a value to the sink.
Each call to this function must be preceded by a successful call to
poll_ready which returned Poll::Ready(Ok(())). Read moreSource§impl<T> Sink<ProtocolMessage> for BuffedStreamWriteHalf<T>where
T: AsyncWrite + Unpin,
impl<T> Sink<ProtocolMessage> for BuffedStreamWriteHalf<T>where
T: AsyncWrite + Unpin,
Source§fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Attempts to prepare the
Sink to receive a value. Read moreSource§fn start_send(
self: Pin<&mut Self>,
item: ProtocolMessage,
) -> Result<(), Self::Error>
fn start_send( self: Pin<&mut Self>, item: ProtocolMessage, ) -> Result<(), Self::Error>
Begin the process of sending a value to the sink.
Each call to this function must be preceded by a successful call to
poll_ready which returned Poll::Ready(Ok(())). Read moreimpl BincodeMessage for ProtocolMessage
impl Eq for ProtocolMessage
impl StructuralPartialEq for ProtocolMessage
Auto Trait Implementations§
impl Freeze for ProtocolMessage
impl RefUnwindSafe for ProtocolMessage
impl Send for ProtocolMessage
impl Sync for ProtocolMessage
impl Unpin for ProtocolMessage
impl UnwindSafe for ProtocolMessage
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
Mutably borrows from an owned value. Read more