Module parsing

Source
Expand description

Helper functions that convert common C types (primarily UTF-8 encoded char * pointers) into the Rust data structures used throughout PoseiTrader.

The conversions are opinionated:

  • JSON is used as the interchange format for complex structures.
  • ustr::Ustr is preferred over String where possible for its performance benefits.

All functions are #[must_use] and, unless otherwise noted, assume that the input pointer is non-null and points to a valid, null-terminated UTF-8 string.

Functions§

bytes_to_string_vec
Convert a C bytes pointer into an owned Vec<String>.
min_increment_precision_from_cstr
Return the minimum price increment decimal precision inferred from the given C string.
optional_bytes_to_json
Convert a C bytes pointer into an owned Option<HashMap<String, Value>>.
optional_bytes_to_str_map
Convert a C bytes pointer into an owned Option<HashMap<Ustr, Ustr>>.
optional_bytes_to_str_vec
Convert a C bytes pointer into an owned Option<Vec<String>>.
precision_from_cstr
Return the decimal precision inferred from the given C string.
string_vec_to_bytes
Convert a slice of String into a C string pointer (JSON encoded).
u8_as_bool
Return a bool value from the given u8.