Now that we know how crates and modules go together and how their scope allows for the modules to not become confused if they function with the same name (Car::Engine and Car::Electics can both have a function called voltage_to_earth, for example, each does a different action), let's consider our math library.
The library will have four modules with a number of submodules:
- Trigonometry:
- Sin/Cos/Tan
- Arcsin, Arccos, and Arctan
- Regression analysis:
- Intercept on a straight line
- Standard deviation and r2 value
- Conversions:
- Temperature, pressure, and volume
- Base functions:
- Base n to base 10 conversions
- Base 10 to base n conversions
- Base m to base n addition, subtraction, multiplication, and division