pub enum ProtocolError<'a> {
InvalidHost(&'a str),
InvalidKey(&'a str),
RemoteFailed(&'a str),
Unknown(&'a str),
}Expand description
A helper type for protocol errors.
This is used to send and receive errors over the network. It is also used to serialize and deserialize errors.
It should not be sent / received over the network, as it
should be sent as a ProtocolMessage::Error message.
The type system should prevent this from happening.
Variants§
Implementations§
Source§impl ProtocolError<'_>
impl ProtocolError<'_>
Sourcepub async fn send_and_bail<T, R>(self, stream: &mut T) -> Res<R>where
T: BincodeSend,
pub async fn send_and_bail<T, R>(self, stream: &mut T) -> Res<R>where
T: BincodeSend,
Sends the error message and shuts down the stream.
The generic parameter R represents the return type expected by the calling function. This method always returns an error, but needs to have the expected return type for the context.
Trait Implementations§
Source§impl<'__de, 'a, __Context> BorrowDecode<'__de, __Context> for ProtocolError<'a>where
'__de: 'a,
impl<'__de, 'a, __Context> BorrowDecode<'__de, __Context> for ProtocolError<'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> Clone for ProtocolError<'a>
impl<'a> Clone for ProtocolError<'a>
Source§fn clone(&self) -> ProtocolError<'a>
fn clone(&self) -> ProtocolError<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for ProtocolError<'a>
impl<'a> Debug for ProtocolError<'a>
Source§impl<'de: 'a, 'a> Deserialize<'de> for ProtocolError<'a>
impl<'de: 'a, 'a> Deserialize<'de> for ProtocolError<'a>
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 Display for ProtocolError<'_>
impl Display for ProtocolError<'_>
Source§impl<'a> Encode for ProtocolError<'a>
impl<'a> Encode for ProtocolError<'a>
Source§impl<'a> PartialEq for ProtocolError<'a>
impl<'a> PartialEq for ProtocolError<'a>
Source§impl<'a> Serialize for ProtocolError<'a>
impl<'a> Serialize for ProtocolError<'a>
impl<'a> Eq for ProtocolError<'a>
impl<'a> StructuralPartialEq for ProtocolError<'a>
Auto Trait Implementations§
impl<'a> Freeze for ProtocolError<'a>
impl<'a> RefUnwindSafe for ProtocolError<'a>
impl<'a> Send for ProtocolError<'a>
impl<'a> Sync for ProtocolError<'a>
impl<'a> Unpin for ProtocolError<'a>
impl<'a> UnwindSafe for ProtocolError<'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