-
Notifications
You must be signed in to change notification settings - Fork 220
Open
Labels
C-zerovecComponent: Yoke, ZeroVec, DataBakeComponent: Yoke, ZeroVec, DataBakeS-smallSize: One afternoon (small bug fix or enhancement)Size: One afternoon (small bug fix or enhancement)T-techdebtType: ICU4X code health and tech debtType: ICU4X code health and tech debt
Milestone
Description
With Rust 1.61 and #1926, we will now be able to do the following:
- Add a general-purpose
zeroslice!
macro - Remove the old type-specific
const
constructors - Migrate users of the problematic
EqULE
trait to use the new convenience macro, and then removeEqULE
For the macro, you should be able to write
// NOTE: The syntax should be bikeshed
static FOO: &ZeroSlice<u16> = zeroslice![<cb>; 222, 333, 444, 555];
which desugars to
static FOO: &ZeroSlice<u16> = $crate::ZeroSlice::from_ule_slice(
&<cb>([222, 333, 444, 555])
);
where <cb>
is a const function that converts from an aligned to unaligned array (i.e. AsULE::to_unaligned
); it would be nice to have a trait for this but we still can't use trait functions in a const context. We can probably write it such that the function only needs to convert from a single T
to a single T::ULE
and call it in a loop. The big thing is that we can write ZeroSlice::from_ule_slice
in a const context now.
Metadata
Metadata
Assignees
Labels
C-zerovecComponent: Yoke, ZeroVec, DataBakeComponent: Yoke, ZeroVec, DataBakeS-smallSize: One afternoon (small bug fix or enhancement)Size: One afternoon (small bug fix or enhancement)T-techdebtType: ICU4X code health and tech debtType: ICU4X code health and tech debt