Skip to content
Snippets Groups Projects

gst/format: introduce Constructor traits

Merged François Laignel requested to merge fengalin/gstreamer-rs:format-constructor-traits into main

This MR introduces 2 changes related to formatted values constructors.

Constructor Traits implemented on numeric types

Introduce a set of Constructor traits which are implemented on integer of float depending on the formatted values. This traits allows building formatted values using expressions such as:

let buffer_nb = 20.buffers();
let size = 42.kibibytes();
let duration = 15.minutes() + 30.seconds();
let quantity = 42.default_format();
let progress = 20.percent();
let progress = 0.2.percent_ratio();

See how it would impact gst-plugins-rs if it were applied:

  • Most changes have to do with ClockTimes, mostly in tests.
  • The following changes apply to the result of mul_div_round invocation.
  • This one applies to Bytes.

Make from_u64 const

The second commit turns the main specific formatted values constructors const.

Edited by François Laignel

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading