[−][src]Attribute Macro wasm_run::main
#[main]
Makes an entrypoint to your binary (not WASM).
It requires to be used with structopt on an enum. Please consult the documentation of
structopt if you don't know how to make an enum with it.
By default it provides a command Build and a command Serve which you can override simply by
providing them manually. Otherwise it uses the defaults (DefaultBuildArgs and
DefaultServeArgs).
There are a number of argument you can provide to the macro:
other_cli_commands: a function that is called if you have added new commands to theenum;prepare_build: a function that is called when the build directory is being prepared (the WASM is not yet optimized withwasm-opt);post_build: a function that is called when the build is finished (after the optimization withwasm-opt);watch: a function that is called when the watcher is being initialized (allowing you to add extra things to watch for example);serve: (only if built with theservefeature): a function that is called when the HTTP serve is getting configured.run_server: (only if built without theservefeature): a function that is called to run the HTTP server.
Please check the "complex" example to see how they can be used.