Derive From for InlineQueryResult

This commit is contained in:
Waffle 2019-09-19 01:34:35 +03:00
parent fda1d37e77
commit d9a974472a

View file

@ -11,7 +11,7 @@ use crate::core::types::{
}; };
/// This object represents one result of an inline query. /// This object represents one result of an inline query.
#[derive(Debug, Serialize, PartialEq, Clone)] #[derive(Debug, Serialize, PartialEq, Clone, From)]
#[serde(tag = "type")] #[serde(tag = "type")]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum InlineQueryResult { pub enum InlineQueryResult {
@ -55,6 +55,21 @@ mod tests {
InlineQueryResult, InlineQueryResultCachedAudio, InputMessageContent, InlineQueryResult, InlineQueryResultCachedAudio, InputMessageContent,
}; };
#[test]
fn into() {
let structure =
InlineQueryResult::CachedAudio(InlineQueryResultCachedAudio {
id: String::from("id"),
audio_file_id: String::from("audio_file_id"),
caption: None,
parse_mode: None,
reply_markup: None,
input_message_content: None,
});
let _: InlineQueryResult = structure.into();
}
#[test] #[test]
fn cached_audio_min_serialize() { fn cached_audio_min_serialize() {
let structure = let structure =