You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
530 B
Rust
33 lines
530 B
Rust
mod options;
|
|
|
|
use crate::Result;
|
|
use std::fmt::Debug;
|
|
|
|
pub use options::*;
|
|
|
|
#[macro_export]
|
|
macro_rules! fix {
|
|
($opt:expr) => {
|
|
$opt.ok_or_else(|| crate::Error::Malformed)?
|
|
};
|
|
}
|
|
|
|
pub trait Endpoint {
|
|
fn path() -> &'static str;
|
|
}
|
|
|
|
pub trait GetEndpoint: Endpoint {
|
|
type Response: FromJson + Debug;
|
|
}
|
|
|
|
pub trait PostEndpoint: Endpoint {
|
|
type Request;
|
|
type Response: FromJson + Debug;
|
|
}
|
|
|
|
pub trait FromJson {
|
|
fn from_json(value: serde_json::Value) -> Result<Self>
|
|
where
|
|
Self: Sized;
|
|
}
|