resistor

Crates.ioresistor
lib.rsresistor
version0.1.0
sourcesrc
created_at2023-05-16 03:24:14.747313
updated_at2023-05-16 04:14:29.075739
descriptioncalculating the resistance of a resistor based on the color bands
homepage
repositoryhttps://github.com/oovm/sub_projects
max_upload_size
id865604
size16,307
SasakiSaki (oovm)

documentation

https://docs.rs/sub_projects

README

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%)");
}
Commit count: 0

cargo fmt