pub struct CheckboxList<T, S> { /* private fields */ }
Expand description
Checkbox list widget
Implementations§
Source§impl<T, S> CheckboxList<T, S>where
T: Display,
S: CheckboxListSettings,
impl<T, S> CheckboxList<T, S>where
T: Display,
S: CheckboxListSettings,
Sourcepub fn new(items: impl IntoIterator<Item = T>) -> Self
pub fn new(items: impl IntoIterator<Item = T>) -> Self
Examples found in repository?
examples/checkbox_list.rs (line 107)
106async fn send_widget(bot: Bot, dialogue: Dialogue, message: Message) -> HandlerResult {
107 let options = CheckboxList::new([Options::A, Options::B, Options::C]);
108
109 let widget = Widget { options };
110
111 bot.send_message(message.chat.id, "Choose options:")
112 .reply_markup(widget.inline_keyboard_markup())
113 .await?;
114
115 dialogue.update(State::EditingWidget(widget)).await?;
116
117 Ok(())
118}
More examples
examples/multiple_widgets.rs (line 149)
146async fn send_complex_widget(bot: Bot, dialogue: Dialogue, message: Message) -> HandlerResult {
147 let shapes = RadioList::new([Shape::Square, Shape::Triangle, Shape::Circle], None);
148
149 let options = CheckboxList::new([Options::A, Options::B, Options::C]);
150
151 let complex_widget = ComplexWidget { shapes, options };
152
153 bot.send_message(message.chat.id, "Choose shape and options:")
154 .reply_markup(complex_widget.inline_keyboard_markup())
155 .await?;
156
157 dialogue
158 .update(State::EditingComplexWidget(complex_widget))
159 .await?;
160
161 Ok(())
162}
pub fn toggle(&mut self, i: usize)
Sourcepub fn schema<W>() -> UpdateHandler<W::Err>
pub fn schema<W>() -> UpdateHandler<W::Err>
Examples found in repository?
More examples
Trait Implementations§
Source§impl<T: Clone, S: Clone> Clone for CheckboxList<T, S>
impl<T: Clone, S: Clone> Clone for CheckboxList<T, S>
Source§fn clone(&self) -> CheckboxList<T, S>
fn clone(&self) -> CheckboxList<T, S>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T, S> Component for CheckboxList<T, S>where
T: Display,
S: CheckboxListSettings,
impl<T, S> Component for CheckboxList<T, S>where
T: Display,
S: CheckboxListSettings,
Source§impl<'de, T, S> Deserialize<'de> for CheckboxList<T, S>where
T: Deserialize<'de>,
impl<'de, T, S> Deserialize<'de> for CheckboxList<T, S>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T, S> From<&CheckboxList<T, S>> for ReplyMarkupwhere
T: Display,
S: CheckboxListSettings,
impl<T, S> From<&CheckboxList<T, S>> for ReplyMarkupwhere
T: Display,
S: CheckboxListSettings,
Source§fn from(value: &CheckboxList<T, S>) -> Self
fn from(value: &CheckboxList<T, S>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<T, S> Freeze for CheckboxList<T, S>where
T: Freeze,
impl<T, S> RefUnwindSafe for CheckboxList<T, S>where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S> Send for CheckboxList<T, S>
impl<T, S> Sync for CheckboxList<T, S>
impl<T, S> Unpin for CheckboxList<T, S>
impl<T, S> UnwindSafe for CheckboxList<T, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Erasable for T
impl<T> Erasable for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more