Expand description
§openstranded-common-helpers
Shared helper functions for parsing .inf file fields across
all openstranded-common-* domain type crates.
These functions were previously duplicated in every common-* crate.
They operate on the HashMap<String, Vec<String>> structure produced
by the inf2ron parser.
§Functions
| Function | Returns | Description |
|---|---|---|
first_str | Option<&str> | Get first value of a field as &str |
first_string | Option<String> | Get first value as owned String |
first_u32 | Option<u32> | Get first value parsed as u32 |
first_f32 | Option<f32> | Get first value parsed as f32 |
parse_color | Option<[u8; 3]> | Parse "R,G,B" colour string |
parse_optional_u32 | Option<u32> | Parse a field that may be "none" or a number |
Functions§
- first_
f32 - Get the first value of a field parsed as
f32. - first_
str - Get the first value of a field as
&str, if present. - first_
string - Get the first value of a field as an owned
String. - first_
u32 - Get the first value of a field parsed as
u32. - parse_
color - Parse a colour string
"R,G,B"into[R, G, B]. - parse_
optional_ u32 - Parse a field that may be
"none"(returnsNone) or a number.