Skip to main content

Reply

Struct Reply 

Source
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>

Source

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.

Source

pub fn on_submit(self, message: M) -> Self

Sent on Enter, or a click on the field’s send button.

Source

pub fn on_cancel(self, message: M) -> Self

Sent on Esc.

Source

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.

Source

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>
where Rc<dyn Fn(String) -> M>: Freeze, Option<M>: Freeze,

§

impl<M> Unpin for Reply<M>
where Rc<dyn Fn(String) -> M>: Unpin, Option<M>: Unpin,

§

impl<M> UnsafeUnpin for Reply<M>
where Rc<dyn Fn(String) -> M>: UnsafeUnpin, Option<M>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.