#[non_exhaustive]pub enum Error {
Io(Error),
Frame(FrameError),
Closed,
InvalidParams(Kind),
AlreadyAnswered,
}Available on crate feature
std only.Expand description
Why the connection, or an operation on it, failed.
§Examples
use rpc_io::{Error, FrameError, Framing, Router};
// A broken header section ends the session: the stream has no reliable
// message boundary left.
let input: &[u8] = b"Content-Length: x\r\n\r\n";
let result = rpc_io::serve(input, std::io::sink(), Framing::ContentLength, Router::new());
assert!(matches!(result, Err(Error::Frame(FrameError::InvalidContentLength))));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Io(Error)
Reading or writing the transport failed. The connection is closed.
Frame(FrameError)
The input stream broke its framing in a way that leaves no reliable
message boundary (see FrameError::is_recoverable). The connection is
closed.
Closed
The connection is closed: the endpoint stopped, its input ended, or its output failed earlier. Nothing more can be sent.
InvalidParams(Kind)
Outgoing params must be an array, an object, or null (sent as no
params); this was another kind of value. Nothing was sent.
AlreadyAnswered
The request was already answered (the peer cancelled it, or the connection answered it for a panicking handler). This reply was not sent.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<FrameError> for Error
impl From<FrameError> for Error
Source§fn from(e: FrameError) -> Self
fn from(e: FrameError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
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