BaseUnit

Shordhand for creating a basic unit with a name and a symbol, and no conversions defined.

When using BaseUnit, in virtually every use case, you also want to define an associated unit instance, as shown below. As there should be no real use for the unit type in user case anyway, you can also use baseUnit which directly returns a unit instance.

  1. struct BaseUnit(string name, string symbol = null)
    @safe
    struct BaseUnit (
    string name
    string symbol = null
    ) {}
  2. eponymoustemplate baseUnit(string name, string symbol = null)

Members

Mixins

__anonymous
mixin UnitImpl
Undocumented in source.

Static functions

toString
string toString(UnitString type)
Undocumented in source. Be warned that the author may not have intended to support it.

Mixed In Members

From mixin UnitImpl

opBinary
auto opBinary(Rhs rhs)

Multiplication/division of two unit instances, yielding a unit instance representing the product/quotient unit.

opBinary
auto opBinary(V rhs)
opBinaryRight
auto opBinaryRight(V lhs)

Multiplication/division of an unit and a value type, constructing a Quantity instance.

SuperSecretAliasToMarkThisAsUnit
alias SuperSecretAliasToMarkThisAsUnit = void
Undocumented in source.

Examples

alias BaseUnit!("Ampere", "A") Ampere;
enum ampere = Ampere.init;
// or
enum ampere = baseUnit!("Ampere", "A");

Meta