mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
Move BotWrapper into bot_wrapper.rs
This commit is contained in:
parent
a8e1dac7bb
commit
e17a4cedd0
2 changed files with 35 additions and 32 deletions
33
src/requests/all/bot_wrapper.rs
Normal file
33
src/requests/all/bot_wrapper.rs
Normal file
|
@ -0,0 +1,33 @@
|
|||
use crate::Bot;
|
||||
use std::ops::Deref;
|
||||
|
||||
/// A wrapper that implements `Clone`, Copy, `PartialEq`, `Eq`, `Debug`, but
|
||||
/// performs no copying, cloning and comparison.
|
||||
///
|
||||
/// Used in the requests bodies.
|
||||
#[derive(Debug)]
|
||||
pub struct BotWrapper<'a>(pub &'a Bot);
|
||||
|
||||
impl PartialEq for BotWrapper<'_> {
|
||||
fn eq(&self, _: &BotWrapper<'_>) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for BotWrapper<'_> {}
|
||||
|
||||
impl<'a> Clone for BotWrapper<'a> {
|
||||
fn clone(&self) -> BotWrapper<'a> {
|
||||
Self(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Copy for BotWrapper<'_> {}
|
||||
|
||||
impl Deref for BotWrapper<'_> {
|
||||
type Target = Bot;
|
||||
|
||||
fn deref(&self) -> &Bot {
|
||||
&self.0
|
||||
}
|
||||
}
|
|
@ -64,7 +64,6 @@ mod unban_chat_member;
|
|||
mod unpin_chat_message;
|
||||
mod upload_sticker_file;
|
||||
|
||||
use crate::Bot;
|
||||
pub use add_sticker_to_set::*;
|
||||
pub use answer_callback_query::*;
|
||||
pub use answer_inline_query::*;
|
||||
|
@ -125,7 +124,6 @@ pub use set_chat_title::*;
|
|||
pub use set_game_score::*;
|
||||
pub use set_sticker_position_in_set::*;
|
||||
pub use set_webhook::*;
|
||||
use std::ops::Deref;
|
||||
pub use std::pin::Pin;
|
||||
pub use stop_message_live_location::*;
|
||||
pub use stop_poll::*;
|
||||
|
@ -133,33 +131,5 @@ pub use unban_chat_member::*;
|
|||
pub use unpin_chat_message::*;
|
||||
pub use upload_sticker_file::*;
|
||||
|
||||
/// A wrapper that implements `Clone`, Copy, `PartialEq`, `Eq`, `Debug`, but
|
||||
/// performs no copying, cloning and comparison.
|
||||
///
|
||||
/// Used in the requests bodies.
|
||||
#[derive(Debug)]
|
||||
struct BotWrapper<'a>(&'a Bot);
|
||||
|
||||
impl PartialEq for BotWrapper<'_> {
|
||||
fn eq(&self, _: &BotWrapper<'_>) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for BotWrapper<'_> {}
|
||||
|
||||
impl<'a> Clone for BotWrapper<'a> {
|
||||
fn clone(&self) -> BotWrapper<'a> {
|
||||
Self(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Copy for BotWrapper<'_> {}
|
||||
|
||||
impl Deref for BotWrapper<'_> {
|
||||
type Target = Bot;
|
||||
|
||||
fn deref(&self) -> &Bot {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
mod bot_wrapper;
|
||||
use bot_wrapper::BotWrapper;
|
||||
|
|
Loading…
Add table
Reference in a new issue