Commit graph

10 commits

Author SHA1 Message Date
François Laignel ced522ed08 Implement ser / de for Date Values, Structure fields and Tags 2019-08-19 15:51:42 +02:00
François Laignel c74eef374a Fix serde for Values with optional Types
Attention: these changes induce breaking changes for the serde
representation of some types.

Serialization of `Value`s used to rely on the `get` function
followed by an `unwrap`. This means that optional types couldn't
be serialized when they were `None`.

This commit distinguishes between the optional `Value` `Types` and
the ones that always return some value.

The `Value`s, `Structure` fields and `Tag`s with following types are
now represented as `Option`s:

- `Buffer`
- `DateTime`
- `Sample` (note: this type is used for `Tag` images)
- `String` (except for `Tag`s - see the comment in `tags_serde.rs`).

The representations for these `Type`s remain unchanged when they are
used in-place (not as part of a `Value`).

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/215
2019-08-19 15:34:24 +02:00
Bastian Köcher d257ece388 Make Value serialize/deserialize Buffers 2018-12-25 01:40:17 +01:00
Sebastian Dröge fa29872863 Fix various clippy warnings in the serde code 2018-10-11 11:58:01 +03:00
Sebastian Dröge eb0a804a50 Run everything through latest rustfmt 2018-10-08 15:02:23 +03:00
François Laignel 6bda3ef174 serde: add roundtrip tests
This allows making sure serialization and deserialization are in sync for
types with asymetrical implementations.
2018-07-30 23:18:30 +03:00
François Laignel ab9cd29bd6 serde: fmt pass
Note: clippy didn't raise any warning
2018-07-30 23:18:30 +03:00
François Laignel fd0c3f4464 Structure: de: pass the new Structure to the Visitor
Use a `DeserializeSeed` to pass the newly created and named `Structure`.
2018-07-30 23:18:30 +03:00
François Laignel 23307a4795 Tags: ser/de: gather tags with the same name together 2018-07-30 23:18:30 +03:00
François Laignel 90b046fbcf serde: separate serde impl and tests from base module
+ fix erroneous `datetime` instead of `buffer` in `BufferRef::serialize`
+ remove ser/de for `Value`s with types `ULong` & `ILong`
2018-07-30 23:18:30 +03:00