mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-11 04:21:12 +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},
|
types::{CallbackQuery, ChosenInlineResult, Message, Update, UpdateKind},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod filters;
|
|
||||||
pub mod error_policy;
|
pub mod error_policy;
|
||||||
|
|
||||||
type Handlers<'a, T, E> =
|
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>
|
impl<T, A, B> Filter<T> for And<A, B>
|
||||||
where
|
where
|
||||||
A: Filter<T>,
|
A: Filter<T>,
|
||||||
B: Filter<T>,
|
B: Filter<T>,
|
||||||
{
|
{
|
||||||
fn test(&self, value: &T) -> bool {
|
fn test(&self, value: &T) -> bool {
|
||||||
self.0.test(value) && self.1.test(value)
|
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>
|
impl<T, A, B> Filter<T> for Or<A, B>
|
||||||
where
|
where
|
||||||
A: Filter<T>,
|
A: Filter<T>,
|
||||||
B: Filter<T>,
|
B: Filter<T>,
|
||||||
{
|
{
|
||||||
fn test(&self, value: &T) -> bool {
|
fn test(&self, value: &T) -> bool {
|
||||||
self.0.test(value) || self.1.test(value)
|
self.0.test(value) || self.1.test(value)
|
||||||
|
@ -157,8 +157,8 @@ impl<A> Not<A> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, A> Filter<T> for Not<A>
|
impl<T, A> Filter<T> for Not<A>
|
||||||
where
|
where
|
||||||
A: Filter<T>,
|
A: Filter<T>,
|
||||||
{
|
{
|
||||||
fn test(&self, value: &T) -> bool {
|
fn test(&self, value: &T) -> bool {
|
||||||
!self.0.test(value)
|
!self.0.test(value)
|
||||||
|
@ -283,8 +283,8 @@ pub fn f<A>(a: A) -> F<A> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, A> Filter<T> for F<A>
|
impl<T, A> Filter<T> for F<A>
|
||||||
where
|
where
|
||||||
A: Filter<T>,
|
A: Filter<T>,
|
||||||
{
|
{
|
||||||
fn test(&self, value: &T) -> bool {
|
fn test(&self, value: &T) -> bool {
|
||||||
self.0.test(value)
|
self.0.test(value)
|
||||||
|
@ -324,8 +324,8 @@ pub trait FilterExt<T> {
|
||||||
///
|
///
|
||||||
/// [`Not::new`]: crate::dispatching::filter::Not::new
|
/// [`Not::new`]: crate::dispatching::filter::Not::new
|
||||||
fn not(self) -> Not<Self>
|
fn not(self) -> Not<Self>
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
Not::new(self)
|
Not::new(self)
|
||||||
}
|
}
|
||||||
|
@ -346,8 +346,8 @@ pub trait FilterExt<T> {
|
||||||
///
|
///
|
||||||
/// [`Not::new`]: crate::dispatching::filter::And::new
|
/// [`Not::new`]: crate::dispatching::filter::And::new
|
||||||
fn and<B>(self, other: B) -> And<Self, B>
|
fn and<B>(self, other: B) -> And<Self, B>
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
And::new(self, other)
|
And::new(self, other)
|
||||||
}
|
}
|
||||||
|
@ -368,8 +368,8 @@ pub trait FilterExt<T> {
|
||||||
///
|
///
|
||||||
/// [`Not::new`]: crate::dispatching::filter::Or::new
|
/// [`Not::new`]: crate::dispatching::filter::Or::new
|
||||||
fn or<B>(self, other: B) -> Or<Self, B>
|
fn or<B>(self, other: B) -> Or<Self, B>
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
Or::new(self, other)
|
Or::new(self, other)
|
||||||
}
|
}
|
|
@ -12,8 +12,8 @@ use crate::types::Message;
|
||||||
/// If you want to compare text and caption use
|
/// If you want to compare text and caption use
|
||||||
/// [MessageTextCaptionFilter]
|
/// [MessageTextCaptionFilter]
|
||||||
///
|
///
|
||||||
/// [MessageTextFilter]: telebofr::dispatching::dispatchers::filter::filters::MessageTextFilter
|
/// [MessageTextFilter]: telebofr::dispatching::filters::MessageTextFilter
|
||||||
/// [MessageTextCaptionFilter]: telebofr::dispatching::dispatchers::filter::filters::MessageTextCaptionFilter
|
/// [MessageTextCaptionFilter]: telebofr::dispatching::filters::MessageTextCaptionFilter
|
||||||
pub struct MessageCaptionFilter {
|
pub struct MessageCaptionFilter {
|
||||||
text: String,
|
text: String,
|
||||||
}
|
}
|
|
@ -12,8 +12,8 @@ use crate::types::Message;
|
||||||
/// If you want to compare text and caption use
|
/// If you want to compare text and caption use
|
||||||
/// [MessageTextCaptionFilter]
|
/// [MessageTextCaptionFilter]
|
||||||
///
|
///
|
||||||
/// [MessageCaptionFilter]: telebofr::dispatching::dispatchers::filter::filters::MessageCaptionFilter
|
/// [MessageCaptionFilter]: telebofr::dispatching::filters::MessageCaptionFilter
|
||||||
/// [MessageTextCaptionFilter]: telebofr::dispatching::dispatchers::filter::filters::MessageTextCaptionFilter
|
/// [MessageTextCaptionFilter]: telebofr::dispatching::filters::MessageTextCaptionFilter
|
||||||
pub struct MessageTextFilter {
|
pub struct MessageTextFilter {
|
||||||
text: String,
|
text: String,
|
||||||
}
|
}
|
|
@ -12,8 +12,8 @@ use crate::types::Message;
|
||||||
/// If you want to compare only text use
|
/// If you want to compare only text use
|
||||||
/// [MessageTextFilter]
|
/// [MessageTextFilter]
|
||||||
///
|
///
|
||||||
/// [MessageCaptionFilter]: telebofr::dispatching::dispatchers::filter::filters::MessageCaptionFilter
|
/// [MessageCaptionFilter]: telebofr::dispatching::filters::MessageCaptionFilter
|
||||||
/// [MessageTextFilter]: telebofr::dispatching::dispatchers::filter::filters::MessageTextFilter
|
/// [MessageTextFilter]: telebofr::filter::filters::MessageTextFilter
|
||||||
pub struct MessageTextCaptionFilter {
|
pub struct MessageTextCaptionFilter {
|
||||||
text: String,
|
text: String,
|
||||||
}
|
}
|
|
@ -1,8 +1,12 @@
|
||||||
|
pub use main::*;
|
||||||
|
|
||||||
pub use command::*;
|
pub use command::*;
|
||||||
pub use message_text::*;
|
pub use message_text::*;
|
||||||
pub use message_caption::*;
|
pub use message_caption::*;
|
||||||
pub use message_text_caption::*;
|
pub use message_text_caption::*;
|
||||||
|
|
||||||
|
mod main;
|
||||||
|
|
||||||
mod command;
|
mod command;
|
||||||
mod message_text;
|
mod message_text;
|
||||||
mod message_caption;
|
mod message_caption;
|
Loading…
Reference in a new issue