add tester timer stub
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
3301cde8e7
commit
5805394ca5
1 changed files with 33 additions and 5 deletions
|
@ -2,13 +2,41 @@ use ruma::events::room::message::RoomMessageEventContent;
|
||||||
|
|
||||||
use crate::Result;
|
use crate::Result;
|
||||||
|
|
||||||
#[cfg_attr(test, derive(Debug))]
|
|
||||||
#[derive(clap::Subcommand)]
|
#[derive(clap::Subcommand)]
|
||||||
|
#[cfg_attr(test, derive(Debug))]
|
||||||
pub(super) enum TesterCommands {
|
pub(super) enum TesterCommands {
|
||||||
Tester,
|
Tester,
|
||||||
|
Timer,
|
||||||
}
|
}
|
||||||
pub(super) async fn process(command: TesterCommands, _body: Vec<&str>) -> Result<RoomMessageEventContent> {
|
|
||||||
Ok(match command {
|
pub(super) async fn process(command: TesterCommands, body: Vec<&str>) -> Result<RoomMessageEventContent> {
|
||||||
TesterCommands::Tester => RoomMessageEventContent::notice_plain(String::from("completed")),
|
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]) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue