pub struct Typing(_);
http
only.Expand description
A struct to start typing in a Channel
for an indefinite period of time.
It indicates that the current user is currently typing in the channel.
Typing is started by using the Typing::start
method
and stopped by using the Typing::stop
method.
Note that on some clients, typing may persist for a few seconds after Typing::stop
is called.
Typing is also stopped when the struct is dropped.
If a message is sent while typing is triggered, the user will stop typing for a brief period
of time and then resume again until either Typing::stop
is called or the struct is dropped.
This should rarely be used for bots, although it is a good indicator that a long-running command is still being processed.
Examples
// Initiate typing (assuming `http` is bound)
let typing = Typing::start(Arc::new(http), 7)?;
// Run some long-running process
long_process();
// Stop typing
typing.stop();
Implementations
sourceimpl Typing
impl Typing
sourcepub fn start(http: Arc<Http>, channel_id: u64) -> Result<Self>
pub fn start(http: Arc<Http>, channel_id: u64) -> Result<Self>
Starts typing in the specified Channel
for an indefinite period of time.
Returns Typing
. To stop typing, you must call the Typing::stop
method on
the returned Typing
object or wait for it to be dropped. Note that on some
clients, typing may persist for a few seconds after stopped.
Errors
Returns an Error::Http
if there is an error.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Typing
impl Send for Typing
impl Sync for Typing
impl Unpin for Typing
impl !UnwindSafe for Typing
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more