Skip to content

gst/format: new panicking constructors and some Percent fixes

Previous proposition for constructing specific formatted values was to use an operation such as 42 * Default::ONE which, in retrospect, doesn't seem idiomatic.

This commit adds from_u64 and from_usize constructors for most formatted values. Having from_usize is convenient when dealing with quantities related to containers indices or length.

This also fixes the Percent from float constructors from which was derived the ONE constant as well as previous display implementation.

Also removed the pub specifier for Undefined inner value. It wasn't removed in a previous commit as Undefined can use the full range of the inner type. But now, it seems preferable not to expose the inner value for proper encapsulation and so as to reduce the differences with other formatted values (kind of least astonishment principle).

Merge request reports

Loading