tuwunel_admin/server/
list_features.rs1use tuwunel_core::{Result, info};
2
3use crate::admin_command;
4
5#[admin_command]
6pub(super) async fn list_features(&self, available: bool, enabled: bool, comma: bool) -> Result {
7 let delim = if comma { "," } else { " " };
8 if enabled && !available {
9 let features = info::rustc::features().join(delim);
10 return write!(self, "`\n{features}\n`").await;
11 }
12
13 if available && !enabled {
14 let features = info::cargo::features().join(delim);
15 return write!(self, "`\n{features}\n`").await;
16 }
17
18 let enabled = info::rustc::features();
19 let available = info::cargo::features();
20 for feature in available {
21 let active = enabled.contains(&feature.as_str());
22 let emoji = if active { "✅" } else { "❌" };
23 let remark = if active { "[enabled]" } else { "" };
24 writeln!(self, "{emoji} {feature} {remark}").await?;
25 }
26
27 Ok(())
28}