mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 06:51:01 +01:00
Derive From
for InlineQueryResult
This commit is contained in:
parent
fda1d37e77
commit
d9a974472a
1 changed files with 16 additions and 1 deletions
|
@ -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 =
|
||||||
|
|
Loading…
Reference in a new issue