Commit graph

19 commits

Author SHA1 Message Date
Guillaume Desmottes a954c03bc0 functions: rename constructors in manual API
The idiomatic way for Rust constructors is to be named from_XXX()
instead of new_from_XXX() and with_XXX() instead of new_with_XXX().

Fix #460
2020-06-11 12:33:52 +02:00
Guillaume Gomez c07fe14191 gstreamer*: Add missing init checks 2020-04-12 17:25:54 +03:00
Sebastian Dröge 7dd0404927 gstreamer/datetime: new_from_g_date_time() can actually return NULL
See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/411
2020-03-22 14:01:32 +02:00
Sebastian Dröge 7230aee069 Switch everything from lazy_static to once_cell::Lazy
Fewer macros, faster compile-time and the Lazy type will likely end up
in the standard library in a similar form to this.
2020-01-22 19:57:41 +02:00
Sebastian Dröge 69be1ce2fc Fix various new clippy warnings from 1.40 2019-12-22 12:10:27 +02:00
Guillaume Gomez 457ac9118b Regenerate with latest gir 2019-11-11 11:34:09 +01:00
François Laignel 1367becfaf DateTime: manual impl for PartialOrd, PartialEq and Debug
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/217
2019-08-21 12:34:15 +02:00
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
François Laignel 514a05accd Manual update for new Value::get signature 2019-08-13 10:57:32 +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 9fd5392a16 value: serde: use stringify for types 2018-07-30 23:18:30 +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 9f2f684188 format: serde: avoid redundant () for some types 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 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