Implement Eq for requests, fix core::requests::send_message::test::default (add .build())

This commit is contained in:
Waffle 2019-09-02 10:49:01 +03:00
parent 6c9ac6125e
commit c84636ebab
3 changed files with 4 additions and 4 deletions

View file

@ -4,7 +4,7 @@ use super::Request;
use reqwest::r#async::multipart::Form;
#[derive(Debug, Constructor)]
#[derive(Debug, Constructor, PartialEq, Eq)]
pub struct GetMe<'a> {
token: &'a str,
}

View file

@ -15,7 +15,7 @@ pub trait Request<R: serde::de::DeserializeOwned> {
}
/// Unique identifier for the target chat or username of the target channel (in the format @channelusername)
#[derive(Debug, Serialize, From)]
#[derive(Debug, Serialize, From, PartialEq, Eq)]
pub enum ChatId {
/// chat identifier
Id(i32), // 32?

View file

@ -4,7 +4,7 @@ use super::{ChatId, Request};
use reqwest::r#async::multipart::Form;
#[derive(Debug, TypedBuilder)]
#[derive(Debug, TypedBuilder, PartialEq, Eq)]
pub struct SendMessage {
token: String,
chat_id: ChatId,
@ -64,7 +64,7 @@ mod test {
#[test]
fn default() {
let sm = SendMessage::builder().token("TOKEN").chat_id(123456.into()).text("text");
let sm = SendMessage::builder().token("TOKEN").chat_id(123456.into()).text("text").build();
let r = SendMessage {
token: String::from("TOKEN"),
chat_id: ChatId::Id(123456),