resistor 0.1.0

calculating the resistance of a resistor based on the color bands
Documentation
  • Coverage
  • 100%
    40 out of 40 items documented1 out of 1 items with examples
  • Size
  • Source code size: 15.97 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.61 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • oovm

Resistor

resistor is a library for calculating the resistance of a resistor based on the color bands.

use resistor::{ResistorBuilder, ResistorColor};
#[test]
fn test_red4() {
    let resistor = ResistorBuilder::FourBand {
        first: ResistorColor::Red,
        second: ResistorColor::Red,
        multiplier: ResistorColor::Red,
        tolerance: ResistorColor::Red,
    }
    .build()
    .unwrap();
    assert_eq!(resistor.resistance, 2200.0);
    assert_eq!(resistor.to_string(), "Resistor(2200Ω ± 2%)");
}