Skip to main content

AsyncUnitsService

Trait AsyncUnitsService 

Source
pub trait AsyncUnitsService {
    // Required methods
    fn get_all_units(
        &self,
        auth_: BearerToken,
    ) -> impl Future<Output = Result<GetUnitsResponse, Error>> + Send;
    fn get_unit(
        &self,
        auth_: BearerToken,
        unit: UnitSymbol,
    ) -> impl Future<Output = Result<Option<Unit>, Error>> + Send;
    fn get_batch_units(
        &self,
        auth_: BearerToken,
        units: BTreeSet<UnitSymbol>,
    ) -> impl Future<Output = Result<BTreeMap<UnitSymbol, Unit>, Error>> + Send;
    fn get_commensurable_units(
        &self,
        auth_: BearerToken,
        unit: UnitSymbol,
    ) -> impl Future<Output = Result<BTreeSet<Unit>, Error>> + Send;
}
Expand description

The Units Service serves as a comprehensive catalog of the units of measurement supported by scout. Units, by default, follow the UCUM convention for representation.

Required Methods§

Source

fn get_all_units( &self, auth_: BearerToken, ) -> impl Future<Output = Result<GetUnitsResponse, Error>> + Send

Returns all known units, grouped by the physical property they measure.

Source

fn get_unit( &self, auth_: BearerToken, unit: UnitSymbol, ) -> impl Future<Output = Result<Option<Unit>, Error>> + Send

Returns information for a unit symbol if available. Returns as empty if the provided symbol cannot be parsed.

Source

fn get_batch_units( &self, auth_: BearerToken, units: BTreeSet<UnitSymbol>, ) -> impl Future<Output = Result<BTreeMap<UnitSymbol, Unit>, Error>> + Send

Returns information for the unit symbols if available. If the provided symbol cannot be parsed, it will be omitted from the map.

Source

fn get_commensurable_units( &self, auth_: BearerToken, unit: UnitSymbol, ) -> impl Future<Output = Result<BTreeSet<Unit>, Error>> + Send

Returns the set of cataloged units that can be converted to and from the given unit. No commensurable units does not imply the unit is invalid. Use /get-unit to check for validity.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§