Skip to content

Commit e5cf890

Browse files
committed
Updated doc tests
1 parent 0acdb15 commit e5cf890

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/relay/local.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,22 @@ use relay::udprelay::local::run as run_udp;
1515
/// Relay server running under local environment.
1616
///
1717
/// ```no_run
18+
/// extern crate tokio;
19+
/// extern crate shadowsocks;
20+
///
1821
/// use shadowsocks::config::{Config, ServerConfig};
1922
/// use shadowsocks::crypto::CipherType;
2023
/// use shadowsocks::relay::local::run;
2124
///
25+
/// use tokio::prelude::*;
26+
///
2227
/// let mut config = Config::new();
2328
/// config.local = Some("127.0.0.1:1080".parse().unwrap());
2429
/// config.server = vec![ServerConfig::basic("127.0.0.1:8388".parse().unwrap(),
2530
/// "server-password".to_string(),
2631
/// CipherType::Aes256Cfb)];
2732
/// let fut = run(config);
28-
/// tokio::run(fut.map_err(|err| panic!("Server run failed with error {}", err));
33+
/// tokio::run(fut.map_err(|err| panic!("Server run failed with error {}", err)));
2934
/// ```
3035
pub fn run(mut config: Config) -> impl Future<Item = (), Error = io::Error> + Send {
3136
let mut vf = Vec::new();

src/relay/server.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,22 @@ use relay::udprelay::server::run as run_udp;
1515
/// Relay server running on server side.
1616
///
1717
/// ```no_run
18+
/// extern crate tokio;
19+
/// extern crate shadowsocks;
20+
///
1821
/// use shadowsocks::config::{Config, ServerConfig};
1922
/// use shadowsocks::crypto::CipherType;
2023
/// use shadowsocks::relay::server::run;
2124
///
25+
/// use tokio::prelude::*;
26+
///
2227
/// let mut config = Config::new();
2328
/// config.server = vec![ServerConfig::basic("127.0.0.1:8388".parse().unwrap(),
2429
/// "server-password".to_string(),
2530
/// CipherType::Aes256Cfb)];
26-
/// run(config);
31+
///
32+
/// let fut = run(config);
33+
/// tokio::run(fut.map_err(|err| panic!("Server run failed with error {}", err)));
2734
/// ```
2835
///
2936
pub fn run(mut config: Config) -> impl Future<Item = (), Error = io::Error> + Send {

0 commit comments

Comments
 (0)