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 overString
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 givenu8
.