Comments (3)
pub enum DimensionEquivalency {
Equivalent, // i.e. length and length
Reciprocal, // i.e. length/time and time/length
Unrelated,
}
pub enum UnitConvertibility {
Convertible, // i.e. meter and foot
InverseConvertible, // i.e. mpg and l/100km
NotConvertible, // i.e. meter and square meter
}
- robertbastian: why do we need this type? does the caller of the API actually need to distinguish between
Convertible
andInverseConvertible
? - younies@: google project A uses
are_convertible
- robertbastian@: so it's just a boolean instead of three values
- younies@: we can return
Option<Converter>
instead of having this enum
impl ConverterFactory {
pub fn converter(&self, unit1: &MeasureUnit, unit2: &MeasureUnit2) -> Option<Converter> { ... }
}
impl Converter {
pub fn convert(&self, ...) -> ... { ... }
// potential future extensions:
pub fn is_inverse(&self) -> bool { ... }
pub fn info(&self) -> ConversionInfo { ... }
}
ConversionInfo {
offset: Ratio<BigInt>,
rate: Ratio<BigInt>,
is_reciprocal: bool,
}
lgtm: @younies, @robertbastian
?: @sffc
from icu4x.
How about naming the struct based on what it is instead of what it is used for, like DimensionRegistry
impl DimensionRegistry {
pub fn converter_for(&self, unit1: &MeasureUnit, unit2: &MeasureUnit2) -> Option<Converter> { ... }
}
On Converter
, seems info
is sufficient here, right? We don't need to add is_inverse
and bikeshed the name of it.
from icu4x.
We do not use is_reciprocal
anymore because we are having three converters right now.
- Proportional
- Reciprocal
- Offset
from icu4x.
Related Issues (20)
- IterableDataProvider::supported_locales is a misnomer HOT 1
- Add try_write_pattern_from_items
- `with_locales_no_fallback` does fallback HOT 14
- Remove DynamicDataProvider and expand methods into ExportableProvider HOT 1
- Add Hangul_Syllable_Type enumerated property
- Now might be a good time to figure out off-the-shelf calendar sets in DateTimeFormatter HOT 7
- Transliterator is missing compiled data constructors HOT 4
- Add Temporal CalendarDateDayOfYear to FFI HOT 1
- Incorrect start date for Meiji era HOT 2
- Incorrect week day for Hebrew calendar when ISO year is negative HOT 1
- Integer sizes of day_of_year, day_of_month HOT 1
- Consider proper design for external loader
- Unicode property `Joining_Group` is not exposed by this library. HOT 2
- Import adjusted UTS 46 data from ICU4C 75 branch HOT 1
- icu_provider_blob contains code that will be rejected by a future version of Rust HOT 1
- Panic when IslamicUmmAlQura month has 31 days HOT 1
- Debug assertion failures with ECMA-262 Temporal.PlainDate minimum and maximum values HOT 10
- Consider renaming APIs involving daylight time HOT 2
- Field `region_format_variants` is unused in TimeZoneFormatsV1
- Release ICU4X 1.5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from icu4x.