mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-22 06:45:37 +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 {
|
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]
|
#[must_use]
|
||||||
pub fn user(&self) -> Option<&User> {
|
pub fn user(&self) -> Option<&User> {
|
||||||
use UpdateKind::*;
|
use UpdateKind::*;
|
||||||
|
@ -52,6 +59,7 @@ impl Update {
|
||||||
Some(from)
|
Some(from)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the chat in which is update has happened, if any.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn chat(&self) -> Option<&Chat> {
|
pub fn chat(&self) -> Option<&Chat> {
|
||||||
use UpdateKind::*;
|
use UpdateKind::*;
|
||||||
|
|
Loading…
Add table
Reference in a new issue