1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use crateState;
use ThermoModel;
/// Capability for constructing a [`State`] from a typed input.
///
/// A thermodynamic [`State`] includes a `Fluid` value. In Twine, `Fluid` is
/// allowed to carry *state-defining* information such as mixture composition,
/// salinity, or any other configuration needed to make the state well-defined.
///
/// `StateFrom<Input>` expresses, at compile time, which combinations of
/// inputs a model can use to construct a state.
/// If a model does not implement `StateFrom<Input>`, then that input is simply
/// not supported (no runtime "not implemented" errors).
///
/// ## Common input patterns
///
/// Inputs are intentionally represented as normal Rust types (often tuples).
/// Common patterns include:
/// - `(Fluid, ThermodynamicTemperature, Pressure)` (temperature + pressure)
/// - `(Fluid, Pressure, MassDensity)` (pressure + density)
/// - `(Fluid, Pressure, SpecificEnthalpy)` (pressure + enthalpy)
/// - `(Fluid, Pressure, SpecificEntropy)` (pressure + entropy)
/// - `(Fluid, ThermodynamicTemperature)` (e.g. for an incompressible liquid)
///
/// Blanket impl for borrowed models.
///
/// Any type that implements `StateFrom<Input>` also implements it when borrowed
/// as `&T`. This allows components that accept a thermo model by reference to
/// use the same trait bounds without requiring ownership.