Fix network/mod.rs

This commit is contained in:
Temirkhan Myrzamadi 2019-09-03 09:39:01 +06:00
parent 7ec19d23c2
commit c6f818e8bb
4 changed files with 7 additions and 6 deletions

View file

@ -29,7 +29,7 @@ fn file_url(base: &str, token: &str, file_path: &str) -> String {
) )
} }
#[derive(Debug, Display, PartialEq, Eq)] #[derive(Debug, Display)]
pub enum RequestError { pub enum RequestError {
#[display(fmt = "Telegram error #{}: {}", status_code, description)] #[display(fmt = "Telegram error #{}: {}", status_code, description)]
ApiError { ApiError {
@ -48,8 +48,8 @@ impl std::error::Error for RequestError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self { match self {
RequestError::ApiError { .. } => None, RequestError::ApiError { .. } => None,
RequestError::NetworkError(err) => err, RequestError::NetworkError(err) => Some(err),
RequestError::InvalidJson(err) => err, RequestError::InvalidJson(err) => Some(err),
} }
} }
} }

View file

@ -11,7 +11,8 @@ pub struct InlineKeyboardButton {
#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize)] #[derive(Debug, Clone, PartialEq, PartialOrd, Serialize)]
pub enum InlineKeyboardButtonKind { pub enum InlineKeyboardButtonKind {
#[serde(rename = "url")] #[serde(rename = "url")]
Url(String), // TODO(knsd): Url? Url(String),
// TODO(knsd): Url?
#[serde(rename = "callback_data")] #[serde(rename = "callback_data")]
CallbackData(String), // TODO(knsd) Validate size? CallbackData(String), // TODO(knsd) Validate size?
// SwitchInlineQuery(String), // SwitchInlineQuery(String),

View file

@ -1,6 +1,6 @@
use serde::Deserialize; use serde::Deserialize;
use crate::core::types::{PhotoSize, MaskPosition}; use crate::core::types::{MaskPosition, PhotoSize};
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct Sticker { pub struct Sticker {

View file

@ -1,6 +1,6 @@
use serde::Deserialize; use serde::Deserialize;
use crate::core::types::{Sticker}; use crate::core::types::Sticker;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct Sticker { pub struct Sticker {