Closed desaikd closed 2 years ago
We should consider making a ToRangeBoundaryValue trait that we can implement for i32, i64, f64, Decimal, Timestamp, etc. If we consolidate to a single range method (as described in another comment), we could then invoke it like this:
ToRangeBoundaryValue
i32
i64
f64
Decimal
Timestamp
range
Range::range(5, 10) Range::range(1.2, 5.9) Range::range(Decimal::new(5, 0), Decimal::new(11, 0))
This short form would default to Inclusive bounds. Someone who wanted exclusive boundaries could use the more verbose syntax.
Inclusive
_Originally posted by @zslayton in https://github.com/amzn/ion-schema-rust/pull/45#discussion_r749556670_
This has already been included by generic range implementation(#95) as below: https://github.com/amzn/ion-schema-rust/blob/42a6f9482af837a57af7a318b15bf9994eaf1b65/src/isl/isl_range.rs#L641-L645
We should consider making a
ToRangeBoundaryValue
trait that we can implement fori32
,i64
,f64
,Decimal
,Timestamp
, etc. If we consolidate to a singlerange
method (as described in another comment), we could then invoke it like this:This short form would default to
Inclusive
bounds. Someone who wanted exclusive boundaries could use the more verbose syntax._Originally posted by @zslayton in https://github.com/amzn/ion-schema-rust/pull/45#discussion_r749556670_