mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-18 15:20:15 +01:00
Rename Update::user
-> Update::from
This commit is contained in:
parent
430175278d
commit
a411bff31c
1 changed files with 7 additions and 2 deletions
|
@ -29,7 +29,7 @@ pub struct Update {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Update {
|
impl Update {
|
||||||
// FIXME: rename user => from, add mentioned_users -> impl Iterator<&User>
|
// FIXME: add mentioned_users -> impl Iterator<&User>
|
||||||
|
|
||||||
/// Returns the user that performed the action that caused this update, if
|
/// Returns the user that performed the action that caused this update, if
|
||||||
/// known.
|
/// known.
|
||||||
|
@ -37,7 +37,7 @@ impl Update {
|
||||||
/// This is generally the `from` field (except for `PollAnswer` where it's
|
/// This is generally the `from` field (except for `PollAnswer` where it's
|
||||||
/// `user` and `Poll` with `Error` which don't have such field at all).
|
/// `user` and `Poll` with `Error` which don't have such field at all).
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn user(&self) -> Option<&User> {
|
pub fn from(&self) -> Option<&User> {
|
||||||
use UpdateKind::*;
|
use UpdateKind::*;
|
||||||
|
|
||||||
let from = match &self.kind {
|
let from = match &self.kind {
|
||||||
|
@ -82,6 +82,11 @@ impl Update {
|
||||||
|
|
||||||
Some(chat)
|
Some(chat)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deprecated(note = "renamed to `from`", since = "0.13.0")]
|
||||||
|
pub fn user(&self) -> Option<&User> {
|
||||||
|
self.from()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
|
|
Loading…
Reference in a new issue