mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 06:51:01 +01:00
moved filters from ..\dispatching\dispatchers\filter\ to ..\dispatching\
This commit is contained in:
parent
5a447bb3c1
commit
f0526d06f1
7 changed files with 26 additions and 23 deletions
|
@ -10,7 +10,6 @@ use crate::{
|
|||
types::{CallbackQuery, ChosenInlineResult, Message, Update, UpdateKind},
|
||||
};
|
||||
|
||||
pub mod filters;
|
||||
pub mod error_policy;
|
||||
|
||||
type Handlers<'a, T, E> =
|
||||
|
|
|
@ -60,9 +60,9 @@ impl<A, B> And<A, B> {
|
|||
}
|
||||
|
||||
impl<T, A, B> Filter<T> for And<A, B>
|
||||
where
|
||||
A: Filter<T>,
|
||||
B: Filter<T>,
|
||||
where
|
||||
A: Filter<T>,
|
||||
B: Filter<T>,
|
||||
{
|
||||
fn test(&self, value: &T) -> bool {
|
||||
self.0.test(value) && self.1.test(value)
|
||||
|
@ -111,9 +111,9 @@ impl<A, B> Or<A, B> {
|
|||
}
|
||||
|
||||
impl<T, A, B> Filter<T> for Or<A, B>
|
||||
where
|
||||
A: Filter<T>,
|
||||
B: Filter<T>,
|
||||
where
|
||||
A: Filter<T>,
|
||||
B: Filter<T>,
|
||||
{
|
||||
fn test(&self, value: &T) -> bool {
|
||||
self.0.test(value) || self.1.test(value)
|
||||
|
@ -157,8 +157,8 @@ impl<A> Not<A> {
|
|||
}
|
||||
|
||||
impl<T, A> Filter<T> for Not<A>
|
||||
where
|
||||
A: Filter<T>,
|
||||
where
|
||||
A: Filter<T>,
|
||||
{
|
||||
fn test(&self, value: &T) -> bool {
|
||||
!self.0.test(value)
|
||||
|
@ -283,8 +283,8 @@ pub fn f<A>(a: A) -> F<A> {
|
|||
}
|
||||
|
||||
impl<T, A> Filter<T> for F<A>
|
||||
where
|
||||
A: Filter<T>,
|
||||
where
|
||||
A: Filter<T>,
|
||||
{
|
||||
fn test(&self, value: &T) -> bool {
|
||||
self.0.test(value)
|
||||
|
@ -324,8 +324,8 @@ pub trait FilterExt<T> {
|
|||
///
|
||||
/// [`Not::new`]: crate::dispatching::filter::Not::new
|
||||
fn not(self) -> Not<Self>
|
||||
where
|
||||
Self: Sized,
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
Not::new(self)
|
||||
}
|
||||
|
@ -346,8 +346,8 @@ pub trait FilterExt<T> {
|
|||
///
|
||||
/// [`Not::new`]: crate::dispatching::filter::And::new
|
||||
fn and<B>(self, other: B) -> And<Self, B>
|
||||
where
|
||||
Self: Sized,
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
And::new(self, other)
|
||||
}
|
||||
|
@ -368,8 +368,8 @@ pub trait FilterExt<T> {
|
|||
///
|
||||
/// [`Not::new`]: crate::dispatching::filter::Or::new
|
||||
fn or<B>(self, other: B) -> Or<Self, B>
|
||||
where
|
||||
Self: Sized,
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
Or::new(self, other)
|
||||
}
|
|
@ -12,8 +12,8 @@ use crate::types::Message;
|
|||
/// If you want to compare text and caption use
|
||||
/// [MessageTextCaptionFilter]
|
||||
///
|
||||
/// [MessageTextFilter]: telebofr::dispatching::dispatchers::filter::filters::MessageTextFilter
|
||||
/// [MessageTextCaptionFilter]: telebofr::dispatching::dispatchers::filter::filters::MessageTextCaptionFilter
|
||||
/// [MessageTextFilter]: telebofr::dispatching::filters::MessageTextFilter
|
||||
/// [MessageTextCaptionFilter]: telebofr::dispatching::filters::MessageTextCaptionFilter
|
||||
pub struct MessageCaptionFilter {
|
||||
text: String,
|
||||
}
|
|
@ -12,8 +12,8 @@ use crate::types::Message;
|
|||
/// If you want to compare text and caption use
|
||||
/// [MessageTextCaptionFilter]
|
||||
///
|
||||
/// [MessageCaptionFilter]: telebofr::dispatching::dispatchers::filter::filters::MessageCaptionFilter
|
||||
/// [MessageTextCaptionFilter]: telebofr::dispatching::dispatchers::filter::filters::MessageTextCaptionFilter
|
||||
/// [MessageCaptionFilter]: telebofr::dispatching::filters::MessageCaptionFilter
|
||||
/// [MessageTextCaptionFilter]: telebofr::dispatching::filters::MessageTextCaptionFilter
|
||||
pub struct MessageTextFilter {
|
||||
text: String,
|
||||
}
|
|
@ -12,8 +12,8 @@ use crate::types::Message;
|
|||
/// If you want to compare only text use
|
||||
/// [MessageTextFilter]
|
||||
///
|
||||
/// [MessageCaptionFilter]: telebofr::dispatching::dispatchers::filter::filters::MessageCaptionFilter
|
||||
/// [MessageTextFilter]: telebofr::dispatching::dispatchers::filter::filters::MessageTextFilter
|
||||
/// [MessageCaptionFilter]: telebofr::dispatching::filters::MessageCaptionFilter
|
||||
/// [MessageTextFilter]: telebofr::filter::filters::MessageTextFilter
|
||||
pub struct MessageTextCaptionFilter {
|
||||
text: String,
|
||||
}
|
|
@ -1,8 +1,12 @@
|
|||
pub use main::*;
|
||||
|
||||
pub use command::*;
|
||||
pub use message_text::*;
|
||||
pub use message_caption::*;
|
||||
pub use message_text_caption::*;
|
||||
|
||||
mod main;
|
||||
|
||||
mod command;
|
||||
mod message_text;
|
||||
mod message_caption;
|
Loading…
Reference in a new issue