Struct serenity::http::typing::Typing[][src]

pub struct Typing(_);
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

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.

Stops typing in Channel.

This should be used to stop typing after it is started using Typing::start. Typing may persist for a few seconds on some clients after this is called.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more