mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-03 09:49:07 +01:00
Document Update::{user, chat}
This commit is contained in:
parent
b5bd147c7c
commit
8baf8af8c1
1 changed files with 8 additions and 0 deletions
|
@ -29,6 +29,13 @@ pub struct Update {
|
|||
}
|
||||
|
||||
impl Update {
|
||||
// FIXME: rename user => from, add mentioned_users -> impl Iterator<&User>
|
||||
|
||||
/// Returns the user that performed the action that caused this update, if
|
||||
/// known.
|
||||
///
|
||||
/// 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).
|
||||
#[must_use]
|
||||
pub fn user(&self) -> Option<&User> {
|
||||
use UpdateKind::*;
|
||||
|
@ -52,6 +59,7 @@ impl Update {
|
|||
Some(from)
|
||||
}
|
||||
|
||||
/// Returns the chat in which is update has happened, if any.
|
||||
#[must_use]
|
||||
pub fn chat(&self) -> Option<&Chat> {
|
||||
use UpdateKind::*;
|
||||
|
|
Loading…
Reference in a new issue