pub enum ProtocolMessage<'a> {
ClientPreamble(ClientPreamble<'a>),
ServerPreamble(ServerPreamble<'a>),
ClientAuthentication(ClientAuthentication<'a>),
HandshakeCompletion,
Data(&'a [u8]),
UdpData(&'a [u8]),
Error(ProtocolError<'a>),
Shutdown,
}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<'a>)
ServerPreamble(ServerPreamble<'a>)
ClientAuthentication(ClientAuthentication<'a>)
HandshakeCompletion
Data(&'a [u8])
UdpData(&'a [u8])
Error(ProtocolError<'a>)
Shutdown
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<'__de, 'a, __Context> BorrowDecode<'__de, __Context> for ProtocolMessage<'a>where
'__de: 'a,
impl<'__de, 'a, __Context> BorrowDecode<'__de, __Context> for ProtocolMessage<'a>where
'__de: 'a,
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
Source§impl<'a> Debug for ProtocolMessage<'a>
impl<'a> Debug for ProtocolMessage<'a>
Source§impl<'a> Encode for ProtocolMessage<'a>
impl<'a> Encode for ProtocolMessage<'a>
Source§impl<'a> PartialEq for ProtocolMessage<'a>
impl<'a> PartialEq for ProtocolMessage<'a>
impl<'a> Eq for ProtocolMessage<'a>
impl<'a> StructuralPartialEq for ProtocolMessage<'a>
Auto Trait Implementations§
impl<'a> Freeze for ProtocolMessage<'a>
impl<'a> RefUnwindSafe for ProtocolMessage<'a>
impl<'a> Send for ProtocolMessage<'a>
impl<'a> Sync for ProtocolMessage<'a>
impl<'a> Unpin for ProtocolMessage<'a>
impl<'a> UnwindSafe for ProtocolMessage<'a>
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