Expand description
Tools for working with fields that might contain a string, or might contain a struct. This code is based on: https://github.com/emk/compose_yml/blob/7e8e0f47dcc41cf08e15fe082ef4c40b5f0475eb/src/v2/string_or_struct.rs
Structs§
Traits§
- Some structs can be serialized as a string, but only under certain circumstances.
Functions§
- Like
string_or_struct
, but it also handles the case where the value is optional. - Handle a value which may either a struct that deserializes as type
T
, or a bare string that can be turned into a typeT
usingFromStr::from_str
. We do this in a clever way that allows us to be generic over multiple such types, and which allows us to use the structure deserialization code automatically generated by serde. - Like
serialize_string_or_struct
, but can also handle missing values. - Like
serialize_string_or_struct
, but can also handle missing values. - Serialize the specified value as a string if we can, and a struct otherwise.
- Like
serialize_string_or_struct
, but can also handle missing values.