Trait outmove_common::types::gas_schedule::GasAlgebra [−][src]
A trait encoding the operations permitted on the underlying carrier for the gas unit, and how other gas-related units can interact with other units -- operations can only be performed across units with the same underlying carrier (i.e. as long as the underlying data is the same).
Required methods
fn new(carrier: GasCarrier) -> Self
[src]
Project a value into the gas algebra.
fn get(&self) -> GasCarrier
[src]
Get the carrier.
Provided methods
fn map<F: Fn(GasCarrier) -> GasCarrier>(self, f: F) -> Self
[src]
Map a function f
of one argument over the underlying data.
fn map2<F: Fn(GasCarrier, GasCarrier) -> GasCarrier>(
self,
other: impl GasAlgebra<GasCarrier>,
f: F
) -> Self
[src]
self,
other: impl GasAlgebra<GasCarrier>,
f: F
) -> Self
Map a function f
of two arguments over the underlying carrier. Note that this function
can take two different implementations of the trait -- one for self
the other for the
second argument. But, we enforce that they have the same underlying carrier.
fn app<T, F: Fn(GasCarrier, GasCarrier) -> T>(
&self,
other: &impl GasAlgebra<GasCarrier>,
f: F
) -> T
[src]
&self,
other: &impl GasAlgebra<GasCarrier>,
f: F
) -> T
Apply a function f
of two arguments to the carrier. Since f
is not an endomorphism, we
return the resulting value, as opposed to the result wrapped up in ourselves.
fn unitary_cast<T: GasAlgebra<GasCarrier>>(self) -> T
[src]
We allow casting between GasAlgebras as long as they have the same underlying carrier -- i.e. they use the same type to store the underlying value.
fn add(self, right: impl GasAlgebra<GasCarrier>) -> Self
[src]
Add the two GasAlgebra
s together.
fn sub(self, right: impl GasAlgebra<GasCarrier>) -> Self
[src]
Subtract one GasAlgebra
from the other.
fn mul(self, right: impl GasAlgebra<GasCarrier>) -> Self
[src]
Multiply two GasAlgebra
s together.
fn div(self, right: impl GasAlgebra<GasCarrier>) -> Self
[src]
Divide one GasAlgebra
by the other.