I have a rust RPC server in which endpoints in files like /src/entity/subentity/action.rs.
I would like to build a type that includes all my RPC endpoints like the following:
While it can be done with the current API by generating a ts file for each rs file I would like to be able to work in-memory so I don't have to generate ts files, read ts files, build the API type, write the final ts file then cleanup all files but API.ts.
Proposed solution
Either a function like generate_typescript_defs that returns a string or making the generate_typescript_defs return a string so that passing /dev/null as the output parameter results in no actual write to disk and the file content being returned.
Use case
I have a rust RPC server in which endpoints in files like
/src/entity/subentity/action.rs
. I would like to build a type that includes all my RPC endpoints like the following:While it can be done with the current API by generating a
ts
file for eachrs
file I would like to be able to work in-memory so I don't have to generatets
files, readts
files, build the API type, write the finalts
file then cleanup all files but API.ts.Proposed solution
Either a function like
generate_typescript_defs
that returns a string or making thegenerate_typescript_defs
return a string so that passing/dev/null
as the output parameter results in no actual write to disk and the file content being returned.