Commit graph

8 commits

Author SHA1 Message Date
François Laignel
08551bb1bc format/specific: don't expose inner as pub
... users would be able to bypass the range checks and build a
defined Rust value which would be interpreted as `None` in C code.

Added format module examples for formatted values constructions.
2022-10-10 19:23:35 +02:00
François Laignel
f6336b1be3 gst/format: fix Percent Display impl
- The `GST_FORMAT_PERCENT_SCALE` was not used to compute the value
  to display.
- Added `Display` examples in the format module documentation.
- Simplified `glib_newtype_display` macro.
2022-10-10 18:44:59 +02:00
François Laignel
8e2c621a9f gst/lib: cleanup format re-exports 2022-10-10 15:10:10 +02:00
François Laignel
04b6710f84 format/Other: use u64 internally instead of i64 2022-10-09 20:00:38 +02:00
François Laignel
e2fe1d6371 gst/format: macros minor cleanups 2022-10-01 13:16:06 +02:00
François Laignel
57d8d46ab6 gst/format: fix some ops and add others
Some operations were implemented on types that wouldn't result in
the expected physical unit. E.g.:

- `ClockTime / ClockTime` results in a unit-less factor.
- `u64 / ClockTime` would result in a `1 / ClockTime`. Since we don't
  use any `Frequency` type, this operation is removed. Users should
  use the `ClockTime` accessors to compute the expected value.

This commit also adds:

- multiplications with integers as the left hand side operands.
- `Partial{Eq,Ord} for `Signed<T>` with `T` as left hand side operand.
- `opt_add` / `opt_sub` for `Signed<T>` with `T` as left or right hand
   side operands.
- missing tests for `Partial{Eq,Ord}` and `OptionOrd`.

This implementation can interfere with unrelated code and was removed:

- `Signed<usize>.` `PartialOrd` makes existing code computing the len
  of slices needing type annotation because the len is later used in
  a comparison for which the compiler is unable to determine if
  the len is `Signed<usize>` or `usize`.
2022-10-01 13:15:11 +02:00
François Laignel
eb4d997f0a gst/format: shuffle types and traits 2022-10-01 00:49:42 +02:00
François Laignel
79377337a4 gst/format: move related modules under a directory 2022-10-01 00:49:39 +02:00
Renamed from gstreamer/src/macros.rs (Browse further)