Adapted to the latest Rust and ported to Cargo

I've enabled Cargo build for the project and also made it compile with the latest Rust.