Module safe_integer_map

Module safe_integer_map 

Source
Expand description

Serde with modules for BTreeMap fields containing u64 keys and/or values.

Unlike bare u64 fields (handled automatically by #[json_safe_fields]), map fields need explicit #[serde(with = "...")] annotations because the macro cannot inject serde(with) into generic container internals.

§When to use

If a #[json_safe_fields]-annotated struct has a BTreeMap<K, u64> field, the compile-time JsonSafeFields check will fail (u64 doesn’t implement the trait). Add one of these modules as a serde(with) annotation to fix it.

§Available modules

§Behavior

Same as safe_integer.rs: uses is_human_readable() to only stringify in JSON mode. platform_value and bincode stay native.

Modules§

json_safe_generic_u64_value_map
Generic serde with module for BTreeMap<K, u64> fields where K is any serializable/deserializable key type.
json_safe_identifier_u64_map
Serde with module for BTreeMap<Identifier, u64> fields.
json_safe_u64_nested_identifier_u64_map
Serde with module for BTreeMap<u64, BTreeMap<Identifier, u64>> fields.
json_safe_u64_u64_map
Serde with module for BTreeMap<u64, u64> fields.