use-aspect-ratio 0.0.1

Primitive aspect-ratio helpers
Documentation
  • Coverage
  • 6.25%
    1 out of 16 items documented1 out of 13 items with examples
  • Size
  • Source code size: 6.34 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 397.43 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-media
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

Primitive aspect-ratio helpers.

These helpers validate dimensions, simplify ratios, and perform small tolerance checks.

Examples

use use_aspect_ratio::{AspectRatio, aspect_label, fits_aspect_ratio};

let ratio = AspectRatio::new(1920, 1080).unwrap();

assert!((ratio.ratio() - (16.0 / 9.0)).abs() < 1.0e-12);
assert_eq!(ratio.simplified().label(), "16:9");
assert_eq!(aspect_label(1920, 1080).unwrap(), "16:9");
assert!(fits_aspect_ratio(1920, 1080, 1280, 720, 0.001).unwrap());