diff --git a/src/types/inline_keyboard_markup.rs b/src/types/inline_keyboard_markup.rs index 25618524..76294ddd 100644 --- a/src/types/inline_keyboard_markup.rs +++ b/src/types/inline_keyboard_markup.rs @@ -32,25 +32,36 @@ pub struct InlineKeyboardMarkup { impl InlineKeyboardMarkup { pub fn new(inline_keyboard: I1) -> Self where - I1: Into>, - I2: Into>, + I1: IntoIterator, + I2: IntoIterator, { Self { - inline_keyboard: inline_keyboard.into().into_iter().map(Into::into).collect(), + inline_keyboard: inline_keyboard + .into_iter() + .map(<_>::into_iter) + .map(<_>::collect) + .collect(), } } pub fn inline_keyboard(mut self, val: I1) -> Self where - I1: Into>, - I2: Into>, + I1: IntoIterator, + I2: IntoIterator, { - self.inline_keyboard = val.into().into_iter().map(Into::into).collect(); + self.inline_keyboard = val + .into_iter() + .map(<_>::into_iter) + .map(<_>::collect) + .collect(); self } - pub fn append_row(mut self, buttons: Vec) -> Self { - self.inline_keyboard.push(buttons); + pub fn append_row(mut self, buttons: R) -> Self + where + R: IntoIterator, + { + self.inline_keyboard.push(buttons.into_iter().collect()); self } diff --git a/src/types/message_entity.rs b/src/types/message_entity.rs index 872a1cb7..e9742921 100644 --- a/src/types/message_entity.rs +++ b/src/types/message_entity.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -use crate::types::{Message, User}; +use crate::types::User; /// This object represents one special entity in a text message. /// diff --git a/src/types/passport_element_error.rs b/src/types/passport_element_error.rs index da96fba1..c94b6cf2 100644 --- a/src/types/passport_element_error.rs +++ b/src/types/passport_element_error.rs @@ -305,11 +305,11 @@ pub struct PassportElementErrorFiles { impl PassportElementErrorFiles { pub fn new(r#type: PassportElementErrorFilesType, file_hashes: S) -> Self where - S: Into>, + S: IntoIterator, { Self { r#type, - file_hashes: file_hashes.into(), + file_hashes: file_hashes.into_iter().collect(), } } @@ -320,9 +320,9 @@ impl PassportElementErrorFiles { pub fn file_hashes(mut self, val: S) -> Self where - S: Into>, + S: IntoIterator, { - self.file_hashes = val.into(); + self.file_hashes = val.into_iter().collect(); self } } @@ -386,11 +386,11 @@ pub struct PassportElementErrorTranslationFiles { impl PassportElementErrorTranslationFiles { pub fn new(r#type: PassportElementErrorTranslationFilesType, file_hashes: S) -> Self where - S: Into>, + S: IntoIterator, { Self { r#type, - file_hashes: file_hashes.into(), + file_hashes: file_hashes.into_iter().collect(), } } @@ -401,9 +401,9 @@ impl PassportElementErrorTranslationFiles { pub fn file_hashes(mut self, val: S) -> Self where - S: Into>, + S: IntoIterator, { - self.file_hashes = val.into(); + self.file_hashes = val.into_iter().collect(); self } } diff --git a/src/types/reply_keyboard_markup.rs b/src/types/reply_keyboard_markup.rs index 9289329e..b2e8d3b1 100644 --- a/src/types/reply_keyboard_markup.rs +++ b/src/types/reply_keyboard_markup.rs @@ -47,11 +47,15 @@ pub struct ReplyKeyboardMarkup { impl ReplyKeyboardMarkup { pub fn new(keyboard: K1) -> Self where - K1: Into>, - K2: Into>, + K1: IntoIterator, + K2: IntoIterator, { Self { - keyboard: keyboard.into().into_iter().map(Into::into).collect(), + keyboard: keyboard + .into_iter() + .map(<_>::into_iter) + .map(<_>::collect) + .collect(), resize_keyboard: None, one_time_keyboard: None, selective: None, diff --git a/src/types/shipping_option.rs b/src/types/shipping_option.rs index af154d6b..ec6e8a3e 100644 --- a/src/types/shipping_option.rs +++ b/src/types/shipping_option.rs @@ -22,12 +22,12 @@ impl ShippingOption { where S1: Into, S2: Into, - P: Into>, + P: IntoIterator, { Self { id: id.into(), title: title.into(), - prices: prices.into(), + prices: prices.into_iter().collect(), } } @@ -49,9 +49,9 @@ impl ShippingOption { pub fn prices

(mut self, val: P) -> Self where - P: Into>, + P: IntoIterator, { - self.prices = val.into(); + self.prices = val.into_iter().collect(); self } }