跳到主要内容
本页尚未翻译

下面显示的是英文原文。

Command

asyncapi gen prints the document of a service from the main that #[ruststream::app] generates.

The command builds the app with the builder the attribute names and prints what build_spec returns. It prints JSON by default; --yaml prints YAML, and -o <file> writes to a file instead of standard output. The service crate enables the asyncapi feature; without it the command fails with an error that names the feature. The ruststream command runs it through cargo run against a crate, and cargo run -- asyncapi gen does the same without it. A main written by hand gets the same commands from run_main.

Example​

In the service crate:

cargo run -- asyncapi gen
cargo run -- asyncapi gen --yaml -o asyncapi.yaml

With the ruststream command installed:

ruststream asyncapi gen -o asyncapi.json