mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-08 19:33:53 +01:00
Make more functions #[must_use]
This commit is contained in:
parent
7cd36d9c40
commit
762ab2f5e3
5 changed files with 12 additions and 0 deletions
|
@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- `StatefulListener::new_with_hints`
|
- `StatefulListener::new_with_hints`
|
||||||
- `CommandDescriptions::new`
|
- `CommandDescriptions::new`
|
||||||
- `respond`
|
- `respond`
|
||||||
|
- The following functions were made `#[must_use]`:
|
||||||
|
- `DispatcherBuilder::{enable_ctrlc_handler, distribution_function}`
|
||||||
|
|
||||||
## 0.11.1 - 2022-10-31
|
## 0.11.1 - 2022-10-31
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
- The methods `ChatMember::{can_pin_messages, can_invite_users, can_change_info}` now take into account the permissions of `Restricted` chat member kind ([#764][pr764])
|
- The methods `ChatMember::{can_pin_messages, can_invite_users, can_change_info}` now take into account the permissions of `Restricted` chat member kind ([#764][pr764])
|
||||||
- The method `ChatMemberKind::is_present` now takes into account the value of `Restricted::is_member` field ([#764][pr764])
|
- The method `ChatMemberKind::is_present` now takes into account the value of `Restricted::is_member` field ([#764][pr764])
|
||||||
|
- The following functions were made `#[must_use]`:
|
||||||
|
- `MaskPoint::{new, point}`
|
||||||
|
- `StickerKind::{premium_animation, mask_position, custom_emoji_id}`
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,12 @@ pub enum MaskPoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MaskPosition {
|
impl MaskPosition {
|
||||||
|
#[must_use]
|
||||||
pub const fn new(point: MaskPoint, x_shift: f64, y_shift: f64, scale: f64) -> Self {
|
pub const fn new(point: MaskPoint, x_shift: f64, y_shift: f64, scale: f64) -> Self {
|
||||||
Self { point, x_shift, y_shift, scale }
|
Self { point, x_shift, y_shift, scale }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
pub const fn point(mut self, val: MaskPoint) -> Self {
|
pub const fn point(mut self, val: MaskPoint) -> Self {
|
||||||
self.point = val;
|
self.point = val;
|
||||||
self
|
self
|
||||||
|
|
|
@ -200,6 +200,7 @@ impl StickerKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Getter for [`StickerKind::Regular::premium_animation`].
|
/// Getter for [`StickerKind::Regular::premium_animation`].
|
||||||
|
#[must_use]
|
||||||
pub fn premium_animation(&self) -> Option<&FileMeta> {
|
pub fn premium_animation(&self) -> Option<&FileMeta> {
|
||||||
if let Self::Regular { premium_animation } = self {
|
if let Self::Regular { premium_animation } = self {
|
||||||
premium_animation.as_ref()
|
premium_animation.as_ref()
|
||||||
|
@ -209,6 +210,7 @@ impl StickerKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Getter for [`StickerKind::Mask::mask_position`].
|
/// Getter for [`StickerKind::Mask::mask_position`].
|
||||||
|
#[must_use]
|
||||||
pub fn mask_position(&self) -> Option<MaskPosition> {
|
pub fn mask_position(&self) -> Option<MaskPosition> {
|
||||||
if let Self::Mask { mask_position } = self {
|
if let Self::Mask { mask_position } = self {
|
||||||
Some(*mask_position)
|
Some(*mask_position)
|
||||||
|
@ -218,6 +220,7 @@ impl StickerKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Getter for [`StickerKind::CustomEmoji::custom_emoji_id`].
|
/// Getter for [`StickerKind::CustomEmoji::custom_emoji_id`].
|
||||||
|
#[must_use]
|
||||||
pub fn custom_emoji_id(&self) -> Option<&str> {
|
pub fn custom_emoji_id(&self) -> Option<&str> {
|
||||||
if let Self::CustomEmoji { custom_emoji_id } = self {
|
if let Self::CustomEmoji { custom_emoji_id } = self {
|
||||||
Some(custom_emoji_id)
|
Some(custom_emoji_id)
|
||||||
|
|
|
@ -86,6 +86,7 @@ where
|
||||||
///
|
///
|
||||||
/// [`shutdown`]: ShutdownToken::shutdown
|
/// [`shutdown`]: ShutdownToken::shutdown
|
||||||
#[cfg(feature = "ctrlc_handler")]
|
#[cfg(feature = "ctrlc_handler")]
|
||||||
|
#[must_use]
|
||||||
pub fn enable_ctrlc_handler(self) -> Self {
|
pub fn enable_ctrlc_handler(self) -> Self {
|
||||||
Self { ctrlc_handler: true, ..self }
|
Self { ctrlc_handler: true, ..self }
|
||||||
}
|
}
|
||||||
|
@ -100,6 +101,7 @@ where
|
||||||
|
|
||||||
/// Specifies the distribution function that decides how updates are grouped
|
/// Specifies the distribution function that decides how updates are grouped
|
||||||
/// before execution.
|
/// before execution.
|
||||||
|
#[must_use]
|
||||||
pub fn distribution_function<K>(
|
pub fn distribution_function<K>(
|
||||||
self,
|
self,
|
||||||
f: fn(&Update) -> Option<K>,
|
f: fn(&Update) -> Option<K>,
|
||||||
|
|
Loading…
Reference in a new issue