I am trying to run the hyper example listed on the Github readme.
extern crate hyper;
use std::io::Write;
use hyper::Server;
use hyper::server::Request;
use hyper::server::Response;
use hyper::net::Fresh;
fn hello(_: Request, res: Response<Fresh>) {
let mut res = res.start().unwrap();
res.write_all(b"Hello World!").unwrap();
res.end().unwrap();
}
fn main() {
Server::http(hello).listen("127.0.0.1:3000").unwrap();
}
And the Cargo.toml looks like this:
[package]
name = <crate_name>
version = <version>
authors = <authors>
[dependencies]
hyper = "0.3"
However, when I attempt to build it using Cargo run I get the following error:
error: invalid character `-` in crate name: `build-script-build`
error: invalid character `-` in crate name: `pkg-config`
error: invalid character `-` in crate name: `rustc-serialize`
I looked through these different crates trying to see if maybe I could just change a "rustc-serialize" to "rustc_serialize" because I think that crate names can no longer have hyphens. However, I couldn't find anything of the sort. I would really like to be able to solve this problem because I have a feeling that I am going to run into this error a few more times while Rust is still being polished.
Edit: The versions are as follows: Rust: 1.0.0-beta.2 Hyper: 0.3.14 Cargo: 0.0.1-pre-nightly (built 2015-03-09)