Remove Option from KeyboardMarkup::input_field_placeholder

This commit is contained in:
Maybe Waffle 2023-02-15 16:48:45 +04:00
parent 8eda6cd853
commit 4fbd8510c8
2 changed files with 6 additions and 4 deletions

View file

@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Types of `Option<bool>` fields of `KeyboardMarkup`, `KeyboardRemove` and `ForceReply` to `bool` ([#853][pr853])
- Type of `KeyboardMarkup::input_field_placeholder`: `Option<String>` => `String` ([#853][pr853])
[pr852]: https://github.com/teloxide/teloxide/pull/853

View file

@ -42,7 +42,8 @@ pub struct KeyboardMarkup {
/// The placeholder to be shown in the input field when the keyboard is
/// active; 1-64 characters.
pub input_field_placeholder: Option<String>,
#[serde(skip_serializing_if = "str::is_empty")]
pub input_field_placeholder: String,
/// Use this parameter if you want to show the keyboard to specific users
/// only. Targets: 1) users that are `@mentioned` in the `text` of the
@ -70,7 +71,7 @@ impl KeyboardMarkup {
is_persistent: false,
resize_keyboard: false,
one_time_keyboard: false,
input_field_placeholder: None,
input_field_placeholder: String::new(),
selective: false,
}
}
@ -113,10 +114,10 @@ impl KeyboardMarkup {
Self { one_time_keyboard: true, ..self }
}
// FIXME: document + remove Option from signature.
// FIXME: document
pub fn input_field_placeholder<T>(self, val: T) -> Self
where
T: Into<Option<String>>,
T: Into<String>,
{
Self { input_field_placeholder: val.into(), ..self }
}