pub(crate) fn asset_for_subject(subject: &str, default_asset: u32) -> u32Expand description
Finds the asset number a message belongs to.
Legacy subjects carry the asset as their own token (<root>.<asset>.data.chNN),
and the legacy wildcard receives every asset under the root, so the asset is read
from the subject. Structured subjects (<root>.<site>.<box>.<source>.live.chNN)
have no asset token, but the structured wildcard only receives one source, so the
configured asset is used for them.
§Arguments
subject- Subject of a received message.default_asset- Asset number fromASSET_NUMBER.
§Returns
The asset number from a legacy subject, or default_asset when the subject is
not legacy or its asset token is not a number.
§Examples
asset_for_subject("avenabox.1456.data.ch03", 1) -> 1456
asset_for_subject("avenabox.007.data.ch03", 1) -> 7
asset_for_subject("avenars.i69.i69-mu1.i69-lj2.live.ch11", 1) -> 1