Merge pull request #693 from teloxide/nicer_filter_ext_docs

Make filter ext docs a little bit nicer

Former-commit-id: acd3f4f9a2
This commit is contained in:
Waffle Maybe 2022-07-25 11:08:20 +04:00 committed by GitHub
commit 2df4dfd61b

View file

@ -56,11 +56,11 @@ mod private {
macro_rules! define_message_ext { macro_rules! define_message_ext {
($( ($func:ident, $fn_name:path) ,)*) => { ($( ($func:ident, $fn_name:path) ,)*) => {
define_ext! { define_ext! {
MessageFilterExt, crate::types::Message => MessageFilterExt, Message =>
$(( $((
$func, $func,
(|x| $fn_name(&x).map(ToOwned::to_owned)), (|x| $fn_name(&x).map(ToOwned::to_owned)),
concat!("Applies the [`crate::types::", stringify!($fn_name), "`] filter.") concat!("Applies the [`", stringify!($fn_name), "`] filter.")
),)* ),)*
} }
} }
@ -89,14 +89,14 @@ define_message_ext! {
macro_rules! define_update_ext { macro_rules! define_update_ext {
($( ($func:ident, $kind:path, $Allowed:ident) ,)*) => { ($( ($func:ident, $kind:path, $Allowed:ident) ,)*) => {
define_ext! { define_ext! {
UpdateFilterExt, crate::types::Update => UpdateFilterExt, Update =>
$(( $((
$func, $func,
|update: Update| match update.kind { |update: Update| match update.kind {
$kind(x) => Some(x), $kind(x) => Some(x),
_ => None, _ => None,
}, },
concat!("Filters out [`crate::types::", stringify!($kind), "`] objects."), concat!("Filters out [`", stringify!($kind), "`] objects."),
$Allowed $Allowed
),)* ),)*
} }