force-electric
force-electric is a dependency-free Rust library for a compact set of
electrical relationships. It uses validated unit types instead of unlabelled
numbers and keeps these principles connected:
- Ohm's law: voltage, current, and resistance;
- DC power: voltage multiplied by current;
- series and parallel equivalent resistance;
- energy: power integrated over time.
Example
use ;
let point = from_voltage_and_resistance?;
assert_eq!;
assert_eq!;
let energy = from_power_over?;
assert_eq!;
let parallel = parallel_resistance?;
assert!;
# Ok::
Run the bundled example:
cargo run --example dc_circuit
Scope and safety
The crate models ideal scalar DC relationships. It does not model AC phase, reactance, transients, temperature, component tolerances, insulation, protective devices, or regulatory compliance. It is not a substitute for qualified electrical design or safe measurement practice.
License
MIT