pub struct Reply<M> { /* private fields */ }Expand description
A field on a Notice to type an answer into, like a reply to a message: several lines,
Enter sends and Shift+Enter starts a new line.
It shows with the notice, but the host takes the keyboard only once it’s clicked, and gives it back on Esc, on sending, or on a click elsewhere. The notice doesn’t expire while it has the keyboard.
Implementations§
Source§impl<M> Reply<M>
impl<M> Reply<M>
Sourcepub fn new(
placeholder: impl Into<String>,
value: impl Into<String>,
on_input: impl Fn(String) -> M + 'static,
) -> Self
pub fn new( placeholder: impl Into<String>, value: impl Into<String>, on_input: impl Fn(String) -> M + 'static, ) -> Self
Shows value, and sends on_input with the new text on every change.
Sourcepub fn on_submit(self, message: M) -> Self
pub fn on_submit(self, message: M) -> Self
Sent on Enter, or a click on the field’s send button.
Sourcepub fn sent(self, sent: bool) -> Self
pub fn sent(self, sent: bool) -> Self
The answer went: the host says so in the field’s place. Keep the notice a moment after sending, so it can be read.
pub fn map<N: 'static>(
self,
f: &(impl Fn(M) -> N + Clone + 'static),
) -> Reply<N>where
M: 'static,
Auto Trait Implementations§
impl<M> !RefUnwindSafe for Reply<M>
impl<M> !Send for Reply<M>
impl<M> !Sync for Reply<M>
impl<M> !UnwindSafe for Reply<M>
impl<M> Freeze for Reply<M>
impl<M> Unpin for Reply<M>
impl<M> UnsafeUnpin for Reply<M>
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