-
Notifications
You must be signed in to change notification settings - Fork 259
Open
Description
The wit_bindgen::generate! macro generates a export! macro which has the following syntax supported:
($ty:ident) => ...;
($ty:ident with_types_in $($path_to_types_root:tt)*) => ...;
Since $ty is an ident only, it means I'm unable to pass in a path or type with generics, which is quite limiting.
My use case is something like this:
#[macro_export]
macro_rules! export_projection {
($ty:path) => {
$crate::runtime::projection::export!(
$crate::runtime::projection::Projection<$ty> with_types_in $crate::runtime::projection
);
};
}
pub struct Projection<T>(PhantomData<T>);
pub struct ProjectionState<T> {
inner: RefCell<T>,
}
impl<T: EventHandler + 'static> Guest for Projection<T> {
type ProjectionState = ProjectionState<T>;
}
impl<T: EventHandler + 'static> GuestProjectionState for ProjectionState<T> {
...
}But with the export! macro only accepting an ident, it becomes problematic.
I've experimented with simply changing wit_bindgen to use path instead of ident, which seems to work no problem. The only issue is with_types_in isn't supported here, so it needs to be changed to something like $ty => $path_to_types_root.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels