Add function and prefer .iter()
This commit is contained in:
parent
53c6fcd917
commit
e3adc35221
12 changed files with 117 additions and 67 deletions
src/handlers
|
@ -6,7 +6,7 @@ use serde::{Serialize, Serializer};
|
|||
#[derive(Debug)]
|
||||
pub enum HandlerError {
|
||||
BadUid,
|
||||
ProtectedSchedule
|
||||
ProtectedSchedule,
|
||||
}
|
||||
|
||||
impl HandlerError {
|
||||
|
@ -16,13 +16,12 @@ impl HandlerError {
|
|||
HandlerError::ProtectedSchedule => StatusCode::FORBIDDEN,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl Serialize for HandlerError {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
let mut s = serializer.serialize_struct("error", 2)?;
|
||||
s.serialize_field("code", &self.get_code().as_u16())?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue