pub struct ChatActionGuard { /* private fields */ }Expand description
RAII guard that keeps a chat action active until dropped
When created, immediately sends the action and starts auto-renewal. When dropped, signals the background task to stop.
§Example
ⓘ
async fn slow_command(ctx: Context) -> String {
let _typing = ctx.typing(); // Starts typing indicator
expensive_work().await;
"Done!"
} // Typing stops when _typing is droppedImplementations§
Source§impl ChatActionGuard
impl ChatActionGuard
Sourcepub fn start(sender: Box<dyn ChatActionSender>, action: ChatAction) -> Self
pub fn start(sender: Box<dyn ChatActionSender>, action: ChatAction) -> Self
Create and start a chat action indicator
The action is sent immediately and renewed automatically until the guard is dropped.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChatActionGuard
impl RefUnwindSafe for ChatActionGuard
impl Send for ChatActionGuard
impl Sync for ChatActionGuard
impl Unpin for ChatActionGuard
impl UnsafeUnpin for ChatActionGuard
impl UnwindSafe for ChatActionGuard
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