Skip to main content

extract_channel_token

Function extract_channel_token 

Source
pub(crate) fn extract_channel_token(subject: &str) -> Option<String>
Expand description

Extracts the final subject token, which is expected to be the channel name.

§Arguments

  • subject - Subject of a received message.

§Returns

The text after the last . (the whole subject if it has no .). With str::split this is always Some, so the None case in main is not reached in practice.

§Examples

extract_channel_token("avenars.i69.i69-mu1.i69-lj2.live.ch11") -> Some("ch11")
extract_channel_token("avenabox.1456.data.ch03")              -> Some("ch03")