tuwunel_admin/debug/
tester.rs1use tuwunel_core::{Err, Result};
2
3use crate::{admin_command, admin_command_dispatch};
4
5#[admin_command_dispatch]
6#[derive(Debug, clap::Subcommand)]
7pub(crate) enum TesterCommand {
8 Panic,
9 Failure,
10 Tester,
11 Timer,
12}
13
14#[rustfmt::skip]
15#[admin_command]
16async fn panic(&self) -> Result {
17
18 panic!("panicked")
19}
20
21#[rustfmt::skip]
22#[admin_command]
23async fn failure(&self) -> Result {
24
25 Err!("failed")
26}
27
28#[inline(never)]
29#[rustfmt::skip]
30#[admin_command]
31async fn tester(&self) -> Result {
32
33 self.write_str("Ok").await
34}
35
36#[inline(never)]
37#[rustfmt::skip]
38#[admin_command]
39async fn timer(&self) -> Result {
40 let started = std::time::Instant::now();
41 timed(self.body);
42
43 let elapsed = started.elapsed();
44 self.write_str(&format!("completed in {elapsed:#?}")).await
45}
46
47#[inline(never)]
48#[rustfmt::skip]
49#[expect(unused_variables)]
50fn timed(body: &[&str]) {
51
52}