Added inline to the functions that can be considered utilities

This commit is contained in:
StNicolay 2023-05-15 19:17:52 +03:00
parent 02d090dd6a
commit a271b72038
Signed by: StNicolay
GPG Key ID: 9693D04DCD962B0D
5 changed files with 5 additions and 0 deletions

View File

@ -21,6 +21,7 @@ fn filter(q: CallbackQuery) -> bool {
}
/// Gets a handler for deleting the message
#[inline]
pub fn get_handler() -> Handler<'static, DependencyMap, crate::Result<()>, DpHandlerDescription> {
dptree::filter(filter).endpoint(run)
}

View File

@ -28,6 +28,7 @@ fn check_generated_password(password: &[u8]) -> bool {
}
/// Continuously generates the password until it passes the checks
#[inline]
fn generete_passwords() -> ArrayVec<ArrayString<34>, 10> {
let mut passwords = ArrayVec::new_const();
while !passwords.is_full() {

View File

@ -37,6 +37,7 @@ async fn notify_about_no_master_pass(
}
/// Gets a handler that filters out the messages of users that don't have a master password set
#[inline]
pub fn get_handler() -> Handler<'static, DependencyMap, crate::Result<()>, DpHandlerDescription> {
dptree::filter_map_async(master_pass_exists).endpoint(notify_about_no_master_pass)
}

View File

@ -7,6 +7,7 @@ use sea_orm::prelude::*;
use teloxide::{adaptors::Throttle, prelude::*};
/// A generic state handler. It checks for "/cancel" messages and runs the provided validation function
#[inline]
pub async fn generic<F>(
bot: Throttle<Bot>,
msg: Message,

View File

@ -23,6 +23,7 @@ where
}
/// Deletes the message ignoring the errors
#[inline]
pub async fn delete_message(bot: Throttle<Bot>, msg: Message) {
let _ = bot.delete_message(msg.chat.id, msg.id).await;
}