use-spacing-scale 0.0.1

Primitive spacing-scale helpers
Documentation
  • Coverage
  • 9.09%
    1 out of 11 items documented1 out of 8 items with examples
  • Size
  • Source code size: 5.36 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 381.04 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 6s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-typography
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

Primitive spacing scale helpers.

These helpers generate predictable spacing values from a base size and ratio.

Examples

use use_spacing_scale::{SpacingScale, spacing_step, spacing_steps};

let scale = SpacingScale::new(8.0, 2.0).unwrap();

assert_eq!(scale.step(-1), 4.0);
assert_eq!(scale.step(2), 32.0);
assert_eq!(spacing_step(8.0, 2.0, 1).unwrap(), 16.0);
assert_eq!(spacing_steps(8.0, 2.0, -1, 2).unwrap(), vec![4.0, 8.0, 16.0, 32.0]);