Un-seal MultipartPayload

This commit is contained in:
Maybe Waffle 2022-01-12 10:47:51 +03:00
parent dad5d5d4b1
commit c92190e313
2 changed files with 3 additions and 12 deletions

View file

@ -389,7 +389,6 @@ macro_rules! impl_payload {
};
(@[multipart] $Method:ident req { $($reqf:ident),* } opt { $($optf:ident),*} ) => {
impl crate::requests::MultipartPayload for $Method {}
impl crate::requests::multipart_payload::sealed::Sealed for $Method {}
};
(@[] $($ignored:tt)*) => {}
}

View file

@ -1,19 +1,11 @@
use crate::{payloads, requests::Payload};
/// This is a future proof trait. It is `sealed` and can change at any time.
pub trait MultipartPayload: Payload + sealed::Sealed {}
/// Payloads that need to be sent as `multipart/form-data` because they contain
/// files inside.
pub trait MultipartPayload: Payload {}
// HACK(waffle): Sealed trait allows us to change `MultipartPayload` without
// breaking changes & refactor multipart requests later.
pub(crate) mod sealed {
pub trait Sealed {}
}
impl sealed::Sealed for payloads::SendMediaGroup {}
impl MultipartPayload for payloads::SendMediaGroup {}
impl sealed::Sealed for payloads::EditMessageMedia {}
impl MultipartPayload for payloads::EditMessageMedia {}
impl sealed::Sealed for payloads::EditMessageMediaInline {}
impl MultipartPayload for payloads::EditMessageMediaInline {}