icu_provider::dynutil

Macro impl_casting_upcast

Source
macro_rules! impl_casting_upcast {
    ($dyn_m:path, [ $($struct_m:ident),+, ]) => { ... };
}
Expand description

Implements UpcastDataPayload from several data markers to a single data marker that all share the same DynamicDataMarker::DataStruct.

§Examples

use icu_provider::prelude::*;
use std::borrow::Cow;

struct FooV1;
impl DynamicDataMarker for FooV1 {
    type DataStruct = Foo<'static>;
}
icu_provider::data_marker!(BarV1, Foo<'static>);
icu_provider::data_marker!(BazV1, Foo<'static>);

#[derive(yoke::Yokeable)]
pub struct Foo<'data> {
    message: Cow<'data, str>,
};

icu_provider::data_struct!(Foo<'_>);

icu_provider::dynutil::impl_casting_upcast!(FooV1, [BarV1, BazV1,]);