Skip to content

Commit 5c34665

Browse files
committed
friendly to newcomers
1 parent 90694bf commit 5c34665

7 files changed

+19
-0
lines changed

README.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,16 @@ The HTTP implementation based on mio_ and rotor_.
1212
.. _mio: https://crates.io/crates/mio
1313
.. _rotor: https://github.com/tailhook/rotor
1414
.. _libraries and apps using rotor: http://rotor.readthedocs.org/en/latest/ecosystem.html
15+
16+
17+
Examples
18+
--------
19+
20+
You can find some examples in the `examples folder`_.
21+
22+
To run one of them (like `hello_world_server.rs`_)::
23+
24+
cargo run --example hello_world_server
25+
26+
.. _examples folder: ./examples
27+
.. _hello_world_server.rs: ./examples/hello_world_server.rs

examples/hello_world_server.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ impl Server for HelloWorld {
111111
}
112112

113113
fn main() {
114+
println!("Starting http server on http://127.0.0.1:3000/");
114115
let event_loop = rotor::Loop::new(&rotor::Config::new()).unwrap();
115116
let mut loop_inst = event_loop.instantiate(Context {
116117
counter: 0,

examples/threaded.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ impl Server for HelloWorld {
113113
}
114114

115115
fn main() {
116+
println!("Starting http server on http://127.0.0.1:3000/");
116117
let lst = TcpListener::bind(&"127.0.0.1:3000".parse().unwrap()).unwrap();
117118
let threads = env::var("THREADS").unwrap_or("2".to_string())
118119
.parse().unwrap();

examples/threaded_reuse_port.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ impl Server for HelloWorld {
116116
}
117117

118118
fn main() {
119+
println!("Starting http server on http://127.0.0.1:3000/");
119120
let threads = env::var("THREADS").unwrap_or("2".to_string())
120121
.parse().unwrap();
121122
let mut children = Vec::new();

examples/threaded_with_shared_counter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ impl Server for HelloWorld {
118118
}
119119

120120
fn main() {
121+
println!("Starting http server on http://127.0.0.1:3000/");
121122
let lst = TcpListener::bind(&"127.0.0.1:3000".parse().unwrap()).unwrap();
122123
let threads = env::var("THREADS").unwrap_or("2".to_string())
123124
.parse().unwrap();

examples/todobackend.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ impl Server for TodoBackend {
292292

293293
#[cfg(feature="nightly")]
294294
fn main() {
295+
println!("Starting http server on http://127.0.0.1:3000/");
295296
let event_loop = rotor::Loop::new(&rotor::Config::new()).unwrap();
296297
let mut loop_inst = event_loop.instantiate(Context {
297298
last_id: 0,

examples/two_servers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ impl Server for Get {
131131
}
132132

133133
fn main() {
134+
println!("Starting http servers on http://127.0.0.1:3000/ and http://127.0.0.1:3001/");
134135
let lst1 = TcpListener::bind(&"127.0.0.1:3000".parse().unwrap()).unwrap();
135136
let lst2 = TcpListener::bind(&"127.0.0.1:3001".parse().unwrap()).unwrap();
136137
let event_loop = rotor::Loop::new(&rotor::Config::new()).unwrap();

0 commit comments

Comments
 (0)