Skip to content

Commit

Permalink
Merge branch 'fix-context-traits-unusability' into 'master'
Browse files Browse the repository at this point in the history
Fix `context::traits::*` unusability

See merge request SnejUgal/tbot!181
  • Loading branch information
AlexStrNik committed Mar 29, 2020
2 parents 633363b + 1dba10a commit e1377c7
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 91 deletions.
12 changes: 6 additions & 6 deletions src/contexts/traits/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
};

/// Provides methods appliable to callback queries.
pub trait Callback<'a, C: 'static>: fields::Callback<C> {
pub trait Callback<'b, C: 'static>: fields::Callback<C> {
/// Answers the callback query.
///
/// If you don't need to choose the action dynamically, using dedicated
Expand All @@ -15,30 +15,30 @@ pub trait Callback<'a, C: 'static>: fields::Callback<C> {
/// [`open_url`]: #method.open_url
/// [`notify`]: #method.notify
/// [`alert`]: #method.alert
fn answer(
fn answer<'a>(
&'a self,
action: CallbackAction<'a>,
) -> AnswerCallbackQuery<'a, C> {
self.bot().answer_callback_query(self.id().as_ref(), action)
}

/// Answers the query without any action.
fn ignore(&'a self) -> AnswerCallbackQuery<'a, C> {
fn ignore(&self) -> AnswerCallbackQuery<'_, C> {
self.answer(CallbackAction::with_no_action())
}

/// Opens a URL.
fn open_url(&'a self, url: &'a str) -> AnswerCallbackQuery<'a, C> {
fn open_url<'a>(&'a self, url: &'a str) -> AnswerCallbackQuery<'a, C> {
self.answer(CallbackAction::with_url(url))
}

/// Shows a notification to the user.
fn notify(&'a self, text: &'a str) -> AnswerCallbackQuery<'a, C> {
fn notify<'a>(&'a self, text: &'a str) -> AnswerCallbackQuery<'a, C> {
self.answer(CallbackAction::with_notification(text))
}

/// Shows an alert to the user.
fn alert(&'a self, text: &'a str) -> AnswerCallbackQuery<'a, C> {
fn alert<'a>(&'a self, text: &'a str) -> AnswerCallbackQuery<'a, C> {
self.answer(CallbackAction::with_alert(text))
}
}
Expand Down
Loading

0 comments on commit e1377c7

Please sign in to comment.