1
0
Fork 0
mirror of https://forgejo.ellis.link/continuwuation/continuwuity.git synced 2025-07-28 18:58:30 +00:00
continuwuity/src/admin/tester/mod.rs

43 lines
977 B
Rust
Raw Normal View History

use ruma::events::room::message::RoomMessageEventContent;
use crate::Result;
#[derive(clap::Subcommand)]
#[cfg_attr(test, derive(Debug))]
pub(super) enum TesterCommands {
Tester,
Timer,
}
pub(super) async fn process(command: TesterCommands, body: Vec<&str>) -> Result<RoomMessageEventContent> {
match command {
TesterCommands::Tester => tester(body).await,
TesterCommands::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]) {
}