testing
This commit is contained in:
+8
-4
@@ -1,14 +1,16 @@
|
||||
pub type Result<T = Response> = std::result::Result<T, Error>;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Response {
|
||||
Pong,
|
||||
Error(Error),
|
||||
Success,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Response {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Response::Pong => write!(f, "Pong"),
|
||||
Response::Error(error) => write!(f, "!{}", error),
|
||||
Response::Success => write!(f, "Success"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +21,8 @@ pub enum Error {
|
||||
InvalidMethod,
|
||||
InvalidParameter,
|
||||
ParameterNotFound,
|
||||
InvalidSessionToken,
|
||||
InvalidSession,
|
||||
InvalidHandshake,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Error {
|
||||
@@ -29,7 +32,8 @@ impl std::fmt::Display for Error {
|
||||
Error::InvalidMethod => write!(f, "Invalid method"),
|
||||
Error::InvalidParameter => write!(f, "Invalid parameter"),
|
||||
Error::ParameterNotFound => write!(f, "Parameter not found"),
|
||||
Error::InvalidSessionToken => write!(f, "Invalid session token"),
|
||||
Error::InvalidSession => write!(f, "Invalid session"),
|
||||
Error::InvalidHandshake => write!(f, "Invalid handshake"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user