Function coap_numbers::content_format::from_str
source · pub const fn from_str(content_format: &str) -> Option<u16>
Expand description
Match a content format string representation against the list of known content formats.
The string content_format
needs to match the value from the IANA registry verbatim; any
content codeing needs to be suffixed after an “@” character as described in RFC9193 for the
SenML Content-Format field. For the identity coding, that suffix must be omitted.
This function is not intended for embedded use, but as a tool for authors who can write
let cf = content_format::from_str("application/cbor").unwrap();
and thus don’t need to copy around magic numbers.