mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Implement Eq
for requests, fix core::requests::send_message::test::default
(add .build()
)
This commit is contained in:
parent
6c9ac6125e
commit
c84636ebab
3 changed files with 4 additions and 4 deletions
|
@ -4,7 +4,7 @@ use super::Request;
|
||||||
use reqwest::r#async::multipart::Form;
|
use reqwest::r#async::multipart::Form;
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Constructor)]
|
#[derive(Debug, Constructor, PartialEq, Eq)]
|
||||||
pub struct GetMe<'a> {
|
pub struct GetMe<'a> {
|
||||||
token: &'a str,
|
token: &'a str,
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
/// 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 {
|
pub enum ChatId {
|
||||||
/// chat identifier
|
/// chat identifier
|
||||||
Id(i32), // 32?
|
Id(i32), // 32?
|
||||||
|
|
|
@ -4,7 +4,7 @@ use super::{ChatId, Request};
|
||||||
use reqwest::r#async::multipart::Form;
|
use reqwest::r#async::multipart::Form;
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, TypedBuilder)]
|
#[derive(Debug, TypedBuilder, PartialEq, Eq)]
|
||||||
pub struct SendMessage {
|
pub struct SendMessage {
|
||||||
token: String,
|
token: String,
|
||||||
chat_id: ChatId,
|
chat_id: ChatId,
|
||||||
|
@ -64,7 +64,7 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn default() {
|
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 {
|
let r = SendMessage {
|
||||||
token: String::from("TOKEN"),
|
token: String::from("TOKEN"),
|
||||||
chat_id: ChatId::Id(123456),
|
chat_id: ChatId::Id(123456),
|
||||||
|
|
Loading…
Reference in a new issue