1macro_rules! from_subtypes {
2 ($type:ident,) => {};
3 ($type:ident, $name:ident $(, $names:ident)* $(,)?) => {
4 impl<'c> From<$name<'c>> for $type<'c> {
5 fn from(value: $name<'c>) -> Self {
6 unsafe { Self::from_raw(value.to_raw()) }
7 }
8 }
9
10 from_subtypes!($type, $($names,)*);
11 };
12}
13
14macro_rules! from_borrowed_subtypes {
15 ($type:ident,) => {};
16 ($type:ident, $name:ident $(, $names:ident)* $(,)?) => {
17 impl<'c, 'a> From<$name<'c, 'a>> for $type<'c, 'a> {
18 fn from(value: $name<'c, 'a>) -> Self {
19 unsafe { Self::from_raw(value.to_raw()) }
20 }
21 }
22
23 from_borrowed_subtypes!($type, $($names,)*);
24 };
25}