Skip to content

Commit d403500

Browse files
committed
fixup! Reimplement example, compile only with "json" feature enabled
1 parent 9c75677 commit d403500

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/async_source/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ mod example {
55
use config::{builder::AsyncState, AsyncSource, ConfigBuilder, ConfigError, FileFormat, Map};
66

77
use async_trait::async_trait;
8-
use futures::{select, FutureExt};
98
use warp::Filter;
109

1110
// Example below presents sample configuration server and client.
@@ -14,7 +13,7 @@ mod example {
1413
// Client consumes it using custom HTTP AsyncSource built on top of reqwest.
1514

1615

17-
async fn run_server() -> Result<(), Box<dyn Error>> {
16+
pub async fn run_server() -> Result<(), Box<dyn Error>> {
1817
let service = warp::path("configuration").map(|| r#"{ "value" : 123 }"#);
1918

2019
println!("Running server on localhost:5001");
@@ -24,7 +23,7 @@ mod example {
2423
Ok(())
2524
}
2625

27-
async fn run_client() -> Result<(), Box<dyn Error>> {
26+
pub async fn run_client() -> Result<(), Box<dyn Error>> {
2827
// Good enough for an example to allow server to start
2928
tokio::time::sleep(tokio::time::Duration::from_secs(3)).await;
3029

@@ -70,7 +69,8 @@ mod example {
7069

7170
#[cfg(feature = "json")]
7271
#[tokio::main]
73-
async fn main() -> Result<(), Box<dyn Error>> {
72+
async fn main() -> Result<(), Box<dyn std::error::Error>> {
73+
use futures::{select, FutureExt};
7474
select! {
7575
r = example::run_server().fuse() => r,
7676
r = example::run_client().fuse() => r

0 commit comments

Comments
 (0)