pub const PREFIX: &str = "__nonstd_ext_no_ack_"; fn to_no_ack_service_name>(original_name: T) -> String { PREFIX.to_owned() + original_name.as_ref() } fn parse_service_name(service_name: &str) -> (&str, bool) { if service_name.starts_with(PREFIX) { (&service_name[PREFIX.len()..], true) } else { (service_name, false) } } pub struct ServiceName<'a> { pub service_name: &'a str, pub no_ack: bool, } impl<'a> ServiceName<'a> { pub fn from(s: &'a str) -> Self { let (service_name, no_ack) = parse_service_name(s); ServiceName { service_name, no_ack, } } pub fn to_string(&self) -> String { if self.no_ack { to_no_ack_service_name(self.service_name).to_owned() } else { self.service_name.to_string() } } }