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 51 commits into
base: master
Choose a base branch
from
Draft

rustdoc typegen #217

wants to merge 51 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 ed81996 to 13418d4 Compare March 10, 2024 09:18
@StuartHarris StuartHarris force-pushed the rustdoc-typegen branch 2 times, most recently from 6d9d71d to 952a1fe Compare May 29, 2024 13:10
@StuartHarris StuartHarris force-pushed the rustdoc-typegen branch 2 times, most recently from 0d0184d to 875dd59 Compare October 18, 2024 10:55
@StuartHarris StuartHarris force-pushed the rustdoc-typegen branch 4 times, most recently from 4f104e2 to bbfb454 Compare October 28, 2024 16:01
@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 2 times, most recently from 7ee1e77 to fbe6b6b Compare December 7, 2024 10:13
@StuartHarris StuartHarris force-pushed the rustdoc-typegen branch 5 times, most recently from 5fd04bd to 966769e Compare December 17, 2024 15:23
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