Skip to content
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

Changes to specta::Language #150

Open
oscartbeaumont opened this issue Dec 5, 2024 · 1 comment
Open

Changes to specta::Language #150

oscartbeaumont opened this issue Dec 5, 2024 · 1 comment

Comments

@oscartbeaumont
Copy link
Member

oscartbeaumont commented Dec 5, 2024

specta-rs/specta#297

Dedicated crate (Eg. tauri-specta-typescript) via methods:

  • pub struct Language(specta_{language}::Language). Would need to replicate all config methods on langauge.
  • Language::export_to(b: tauri_specta::Builder<R>, path: impl AsRef<Path>) -> Result<(), _>
  • Language::export(b: tauri_specta::Builder<R>) -> Result<String, _>
  • Would allow sealing the specta-typescript crate.
  • This method would not require a LanguageExt trait

The rest of these assume a method in the core like export<L: LanguageExt>(l: L) and a LanguageExt trait.

Reexport:

  • Feature flag for each language
  • pub use specta_{language}::Language + impl LanguageExt for Language enabled by feature flag

Dedicated crate (Eg. tauri-specta-typescript) via trait:

  • pub struct Language(specta_{language}::Language) + impl LanguageExt for Language. Would need to replicate all methods manually which would suck (required due to orphan rule).
  • Would allow sealing the specta-typescript crate.

Current method:

  • Feature flag for each language and the user must add the language crate (ensuring they get the versions correct)
@oscartbeaumont
Copy link
Member Author

oscartbeaumont commented Dec 5, 2024

Even if we change nothing the current method on the Builder is cringe.
export should be export_to and,
export_str should be export.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant