Section III - Creating an Executable
Although this package was created as a library, we can make it dual binary and library by doing the following:
Modifiy the Cargo.toml file to point to a binary during build time
Create a new bin folder in the src directory
Create a new file hello-world.rs in the bin directory with the following code
Build and run the package
There should now be an executable named hello_world in the /target/debug directory which you can execute directly.
Last updated
Was this helpful?