Move Output type and METHOD const from Payloads to Method trait

This commit is contained in:
Waffle 2019-11-04 23:56:54 +03:00
parent 4c2e8029a9
commit b02f10e73c

View file

@ -109,17 +109,19 @@ pub type ResponseResult<T> = Result<T, crate::RequestError>;
// async fn send_boxed(self) -> ResponseResult<Self::Output>;
//}
pub trait Method {
type Output;
const METHOD: &'static str;
}
pub mod json {
use serde::{de::DeserializeOwned, Serialize};
use crate::{Bot, network};
use super::ResponseResult;
use super::{ResponseResult, Method};
pub trait Payload: Serialize {
type Output;
const METHOD: &'static str;
}
pub trait Payload: Serialize + Method {}
pub struct Request<'b, P> {
pub(crate) bot: &'b Bot,
@ -147,13 +149,9 @@ pub mod multipart {
use reqwest::multipart;
use crate::{Bot, network};
use super::ResponseResult;
pub trait Payload {
type Output;
const METHOD: &'static str;
use super::{ResponseResult, Method};
pub trait Payload: Method {
fn payload(&self) -> multipart::Form;
}