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

rustdoc typegen #217

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft

rustdoc typegen #217

wants to merge 24 commits into from

Conversation

StuartHarris
Copy link
Member

@StuartHarris StuartHarris commented Mar 9, 2024

This is an experiment to see whether we can use rustdoc's JSON output to generate foreign types (in TS, Swift and Kotlin) for crux shared libs.

The JSON has all the information we need, so potentially we can use it to list all the types that implement crux_core::App, find their associated types and follow them to their leaves, even crossing crate boundaries (e.g. to crux_http). After we have gathered the relevant type information, we'd need to generate the foreign types, including any serialisation / deserialisation code).

  • add a codegen subcommand to crux_cli
  • invoke cargo doc and generate JSON output
  • deserialise the output into rustdoc-types
  • gather the relevant type information
  • generate foreign types
  • generate serialisation and deserialisation code

@StuartHarris StuartHarris force-pushed the rustdoc-typegen branch 2 times, most recently from 6be7358 to c548406 Compare November 21, 2024 09:44
first stab at generics

begin introducing output types WIP

borrow code from cargo-public-api crate WIP

dig into generic type params

nested generics

respect serde skip

fully qualified names

sorted items

add MIT license

deps

remove typeshare

public_api mod

update public_api from origin

add back tests

all examples in script, and lockfiles

build graph wip
@StuartHarris StuartHarris force-pushed the rustdoc-typegen branch 5 times, most recently from 9ce3eec to 74b80d9 Compare November 25, 2024 16:42
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

Successfully merging this pull request may close these issues.

1 participant