mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-07-30 03:38:31 +00:00
42 lines
973 B
Rust
42 lines
973 B
Rust
use ruma::events::room::message::RoomMessageEventContent;
|
|
|
|
use crate::Result;
|
|
|
|
#[derive(clap::Subcommand)]
|
|
#[cfg_attr(test, derive(Debug))]
|
|
pub(crate) enum TesterCommand {
|
|
Tester,
|
|
Timer,
|
|
}
|
|
|
|
pub(super) async fn process(command: TesterCommand, body: Vec<&str>) -> Result<RoomMessageEventContent> {
|
|
match command {
|
|
TesterCommand::Tester => tester(body).await,
|
|
TesterCommand::Timer => timer(body).await,
|
|
}
|
|
}
|
|
|
|
#[inline(never)]
|
|
#[rustfmt::skip]
|
|
#[allow(unused_variables)]
|
|
async fn tester(body: Vec<&str>) -> Result<RoomMessageEventContent> {
|
|
|
|
Ok(RoomMessageEventContent::notice_plain("completed"))
|
|
}
|
|
|
|
#[inline(never)]
|
|
#[rustfmt::skip]
|
|
async fn timer(body: Vec<&str>) -> Result<RoomMessageEventContent> {
|
|
let started = std::time::Instant::now();
|
|
timed(&body);
|
|
|
|
let elapsed = started.elapsed();
|
|
Ok(RoomMessageEventContent::notice_plain(format!("completed in {elapsed:#?}")))
|
|
}
|
|
|
|
#[inline(never)]
|
|
#[rustfmt::skip]
|
|
#[allow(unused_variables)]
|
|
fn timed(body: &[&str]) {
|
|
|
|
}
|