Crates.io | billios |
lib.rs | billios |
version | 0.2.0 |
source | src |
created_at | 2024-02-20 17:43:57.819097 |
updated_at | 2024-02-22 18:23:41.25413 |
description | A soil library |
homepage | https://github.com/travisbaars/billios |
repository | https://github.com/travisbaars/billios |
max_upload_size | |
id | 1146638 |
size | 31,075 |
This crate is a collection of soil related data structures and formulae.
Standard functionality, no additional dependencies are required:
[dependencies]
billios = "0.2.0"
Alternatively, you can install using the cargo add
command:
cargo add billios
Using this formula only requires a couple lines of code.
Simply call the new()
method with the desired values, then call calculate()
to retrieve the result.
sand_in_cone
value:use billios::field_test::*;
// This constructor takes 3 arguments:
//
// cone_pre_test, cone_post_test, sand_in_cone
//
// The first two are straight forward; two float values.
// For the third we use the `None` option. The reason for this
// is becouse the `sand_in_cone` argument is a constant (mostly).
// In general this value does not change often, so we don't have to worry
// about setting it. Instead we just use `None`. If for some reason you
// needed to change the value, you simple pass in a `Some(<f64>).
let sand_used = SandUsed::new(14.65, 8.75, None);
// In order to get the calculated value we call the `calculate()` method:
let result = sand_used.calculate();
assert_eq!(2.31, result);
sand_in_cone
value:use billios::field_test::SandUsed;
let sand_used = SandUsed::new(14.65, 8.75, Some(3.59));
let result = sand_used.calculate();
assert_eq!(2.31, result);
Using this formula can a little more complicated than the last example. However it is still pretty straghtforward.
dry_density
and moisture_content
values:use billios::field_test::*;
let wet_density = WetDensityChoice::Value(177.1429);
let moisture_content = MoistureContentChoice::Value(0.1428571);
let dry_density = DryDensity::new(wet_density, moisture_content);
let result = dry_density.calculate();
assert_eq!(155., result);
dry_density
and moisture_content
constructors:It is not necessary to calculate each of the values.
use billios::field_test::*;
let wd = WetDensity::new(4.65, 2.31, None);
let wet_density = WetDensityChoice::constructor(wd);
let mc = MoistureContent::new(1600., 1575., 1400.);
let moisture_content = MoistureContentChoice::constructor(mc);
let dry_density = DryDensity::new(wet_density, moisture_content);
let result = dry_density.calculate();
assert_eq!(155., result);
README.md
lib.rs
needs attentionSetter()
methods to calculation structsSandUsedChoices
) to SandUsedOption
domain::types
are accessedutilities.rs
?calculations.rs
to field_test.rs
?