1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
/// Return the individual call flag labels set on the provided mask. #[must_use] pub fn call_flag_labels(flags: u8) -> Vec<&'static str> { let mut labels = Vec::new(); if flags & super::CALL_FLAG_READ_STATES != 0 { labels.push("ReadStates"); } if flags & super::CALL_FLAG_WRITE_STATES != 0 { labels.push("WriteStates"); } if flags & super::CALL_FLAG_ALLOW_CALL != 0 { labels.push("AllowCall"); } if flags & super::CALL_FLAG_ALLOW_NOTIFY != 0 { labels.push("AllowNotify"); } labels } /// Return a human-readable list of call flag names for displaying method tokens. #[must_use] pub fn describe_call_flags(flags: u8) -> String { if flags == 0 { return "None".into(); } let mut labels: Vec<String> = call_flag_labels(flags) .into_iter() .map(str::to_string) .collect(); let unsupported = flags & !super::CALL_FLAGS_ALLOWED_MASK; if unsupported != 0 { labels.push(format!("Unsupported(0x{unsupported:02X})")); } labels.join("|") }