-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exporting generic type with do_export!() #182
Comments
I don't think this macro is in the crate anymore |
Confused about this as well. I don't think we ever had a macro |
Maybe he means the old But I've read some other issues and that doesn't seem like it's the correct syntax for it either. From what I could gather it used to be export!(Type => "path") |
Either way, seems like @is-it-ayush is trying to do the same as #133 |
I apologise!! this is my oopsie. The macro simply called the macro_rules! do_export {
($a:ty) => {{
match <$a>::export() {
Ok(()) => {
println!("✅ {}", <$a>::name());
}
Err(e) => {
println!("❌ {} failed: {}", <$a>::name(), e);
}
}
}};
} In terms of this issue. I ended up writing a bash script that looped over the directory files ending with |
For curiosity's sake, I found where this came from https://github.com/nymtech/nym/blob/30ffea19a1721a9638fba5d7cf09ee982757338d/tools/ts-rs-cli/src/main.rs#L40 |
Hi! I manually export my structs so that I can create an
index.ts
barrel file and re-export generated types for those structs within my rust package. I achieve this withdo_export!()
macro where I first export every struct and then at last create my barrel file.This method works perfectly fine for normal structs. The problem occurs with generic structs that expect a type argument to be passed to them. Here's an example,
I know
ts-rs
supports exporting generic structs but are there any solutions for exporting generic structs withdo_export!()
macro?The text was updated successfully, but these errors were encountered: