pub enum ProtocolError {
InvalidHost(String),
InvalidKey(String),
RemoteFailed(String),
Unknown(String),
}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, __Context> BorrowDecode<'__de, __Context> for ProtocolError
impl<'__de, __Context> BorrowDecode<'__de, __Context> for ProtocolError
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 Clone for ProtocolError
impl Clone for ProtocolError
Source§fn clone(&self) -> ProtocolError
fn clone(&self) -> ProtocolError
Returns a copy 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 Debug for ProtocolError
impl Debug for ProtocolError
Source§impl<__Context> Decode<__Context> for ProtocolError
impl<__Context> Decode<__Context> for ProtocolError
Source§impl<'de> Deserialize<'de> for ProtocolError
impl<'de> Deserialize<'de> for ProtocolError
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 Encode for ProtocolError
impl Encode for ProtocolError
Source§impl PartialEq for ProtocolError
impl PartialEq for ProtocolError
Source§impl Serialize for ProtocolError
impl Serialize for ProtocolError
impl Eq for ProtocolError
impl StructuralPartialEq for ProtocolError
Auto Trait Implementations§
impl Freeze for ProtocolError
impl RefUnwindSafe for ProtocolError
impl Send for ProtocolError
impl Sync for ProtocolError
impl Unpin for ProtocolError
impl UnwindSafe for ProtocolError
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