Rust: “Hello world!”

Rust is a multi-paradigm, applications and systems programming language. It has yet to reach 1.0 but senior C++ developers are predicting it will supersede C++ in the future.

First, download Rust from its website. Then extract the tarball, run the install script and clean up.
install

$ tar -xf rust-nightly-i686-unknown-linux-gnu.tar.gz && sudo rust-nightly-i686-unknown-linux-gnu/install.sh && rm -r rust-nightly-i686-unknown-linux-gnu/ && rm rust-nightly-i686-unknown-linux-gnu.tar.gz

Now create a Hello World! project using Rust’s package manager Cargo:

$ cargo new hello_world --bin

Take a look around in the hello_world directory. You’ll find a manifest file and a source directory. The source directory has main.rs, the generated Hello World! program.

fn main() {
    println!("Hello, world!");
}

Compile and run our Hello World! program from the hello_world directory:

$ cargo run

A similar program in C++ looks like this:

#include <iostream>

int main(void) {
	std::cout << "Hello, world!" << std::endl;
	return 0;
}

Like most Hello world! programs these are trivially different in their result. The main difference is that the main method in the Rust program is a void method while it returns an int in the C++ program. This difference could change the behavior of a non-trivial program, but for Hello world! it has no effect.

PDT For Eclipse Install Error

I am installing the PHP Development Toolkit for Eclipse (PDT) and received this error:

"Cannot complete the install because one or more required items could not be found.
Software being installed: PHP Development Tools (PDT) Mylyn Integration 3.3.1.201409161013 (org.eclipse.php.mylyn.feature.group 3.3.1.201409161013)
Missing requirement: PHP Development Tools (PDT) Mylyn Integration 3.3.1.201409161013 (org.eclipse.php.mylyn.feature.group 3.3.1.201409161013) requires 'org.eclipse.dltk.mylyn.feature.group 0.0.0' but it could not be found"

The error is due to my Eclipse installation missing org.eclipse.dltk.mylyn.feature.group 0.0.0, obviously. The gotcha is that it should be readily available from one of the update sites listed in the Install New Software dialog, however, it is not. To fix this error, add http://download.eclipse.org/technology/dltk/updates-dev/5.0/ to your update sites and retry the install.