Module tango_client::serde[][src]

Expand description

This module implements the serde Serialize and Deserialize traits for the Tango data types CommandData, AttrValue and PropertyValue.

This means that you can easily deserialize the values from any storage format, e.g. JSON or TOML.

However, there is a caveat: Most storage formats do not offer details such as differently sized integer types, or empty arrays of different types. This means that the deserializer cannot know if an empty array is meant to be a LongArray or a StringArray, for example. Tango, however, wants its command arguments and attribute values to be of the exact type that the API specifies and does not make implicit conversions.

As a workaround, all of the three types provide a convert method, which takes a TangoDataType to try to convert to. This type can be directly taken from the CommandInfo or AttributeInfo for the command/attribute.

The convert method will convert integral types into each other and into floats, as well any empty array to any other type of array, and integral arrays into arrays of other integral or floating types.