A hello world crate with automated testing, documentation, continuous integration, tested example code, implemented as a library with a command line tool. Supports Sol and all its planets, not just 'Hello (unspecified) world!'
https://densaugeo.github.io/hellorustyworlds/
Add to Cargo.toml dependencies section:
~~~ [dependencies] hellorustyworlds = { git = "https://github.com/Densaugeo/hellorustyworlds" } ~~~
Then call from your code using extern crate
:
~~~ extern crate hellorustyworlds;
fn main() { println!("{}", hellorustyworlds::hello_world(3).unwrap()); // Prints "Hello Earth!" } ~~~
Install the command line tool through cargo install
:
~~~
[lunariel@morpheus ~]$ cargo install --git https://github.com/Densaugeo/hellorustyworlds
Updating git repository https://github.com/Densaugeo/hello_rusty_worlds
Compiling hellorustyworlds v0.1.0 (https://github.com/Densaugeo/hellorustyworlds#b20dd5c0)
Installing /home/lunariel/.cargo/bin/hello-world
be sure to add /home/lunariel/.cargo/bin
to your PATH to be able to run the installed binaries
~~~
As the message notes, you may need to add cargo's bin folder to your $PATH. This will enable all command line tools installed through cargo. On linux:
~~~ [lunariel@morpheus ~]$ export PATH=$PATH:/home/lunariel/.cargo/bin ~~~
The binary is installed under the name hello-world
, and takes one argument, a planet's number:
~~~ [lunariel@morpheus ~]$ hello-world 1 Hello Mercury! ~~~