unit_t

Struct unit_t 

Source
#[repr(C)]
pub struct unit_t { pub _base: linear_scale<[u8; 0]>, }
Expand description

@ingroup UnitContainers @brief Container for values which represent quantities of a given unit. @details Stores a value which represents a quantity in the given units. Unit containers (except scalar values) are not convertible to built-in c++ types, in order to provide type safety in dimensional analysis. Unit containers are implicitly convertible to other compatible unit container types. Unit containers support various types of arithmetic operations, depending on their scale type.

		The value of a `unit_t` can only be changed on construction, or by assignment
		from another `unit_t` type. If necessary, the underlying value can be accessed
		using `operator()`: @code
		meter_t m(5.0);
		double val = m(); // val == 5.0	@endcode.

@tparam Units unit tag for which type of units the unit_t represents (e.g. meters) @tparam T underlying type of the storage. Defaults to double. @tparam NonLinearScale optional scale class for the units. Defaults to linear (i.e. does not scale the unit value). Examples of non-linear scales could be logarithmic, decibel, or richter scales. Non-linear scales must adhere to the non-linear-scale concept, i.e. is_nonlinear_scale<...>::value must be true. @sa - \ref lengthContainers “length unit containers” - \ref massContainers “mass unit containers” - \ref timeContainers “time unit containers” - \ref angleContainers “angle unit containers” - \ref currentContainers “current unit containers” - \ref temperatureContainers “temperature unit containers” - \ref substanceContainers “substance unit containers” - \ref luminousIntensityContainers “luminous intensity unit containers” - \ref solidAngleContainers “solid angle unit containers” - \ref frequencyContainers “frequency unit containers” - \ref velocityContainers “velocity unit containers” - \ref angularVelocityContainers “angular velocity unit containers” - \ref accelerationContainers “acceleration unit containers” - \ref forceContainers “force unit containers” - \ref pressureContainers “pressure unit containers” - \ref chargeContainers “charge unit containers” - \ref energyContainers “energy unit containers” - \ref powerContainers “power unit containers” - \ref voltageContainers “voltage unit containers” - \ref capacitanceContainers “capacitance unit containers” - \ref impedanceContainers “impedance unit containers” - \ref magneticFluxContainers “magnetic flux unit containers” - \ref magneticFieldStrengthContainers “magnetic field strength unit containers” - \ref inductanceContainers “inductance unit containers” - \ref luminousFluxContainers “luminous flux unit containers” - \ref illuminanceContainers “illuminance unit containers” - \ref radiationContainers “radiation unit containers” - \ref torqueContainers “torque unit containers” - \ref areaContainers “area unit containers” - \ref volumeContainers “volume unit containers” - \ref densityContainers “density unit containers” - \ref concentrationContainers “concentration unit containers” - \ref constantContainers “constant unit containers”

Fields§

§_base: linear_scale<[u8; 0]>

Auto Trait Implementations§

§

impl Freeze for unit_t

§

impl !RefUnwindSafe for unit_t

§

impl Send for unit_t

§

impl !Sync for unit_t

§

impl Unpin for unit_t

§

impl UnwindSafe for unit_t

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more