@@ -5,7 +5,6 @@ mod example {
5
5
use config:: { builder:: AsyncState , AsyncSource , ConfigBuilder , ConfigError , FileFormat , Map } ;
6
6
7
7
use async_trait:: async_trait;
8
- use futures:: { select, FutureExt } ;
9
8
use warp:: Filter ;
10
9
11
10
// Example below presents sample configuration server and client.
@@ -14,7 +13,7 @@ mod example {
14
13
// Client consumes it using custom HTTP AsyncSource built on top of reqwest.
15
14
16
15
17
- async fn run_server ( ) -> Result < ( ) , Box < dyn Error > > {
16
+ pub async fn run_server ( ) -> Result < ( ) , Box < dyn Error > > {
18
17
let service = warp:: path ( "configuration" ) . map ( || r#"{ "value" : 123 }"# ) ;
19
18
20
19
println ! ( "Running server on localhost:5001" ) ;
@@ -24,7 +23,7 @@ mod example {
24
23
Ok ( ( ) )
25
24
}
26
25
27
- async fn run_client ( ) -> Result < ( ) , Box < dyn Error > > {
26
+ pub async fn run_client ( ) -> Result < ( ) , Box < dyn Error > > {
28
27
// Good enough for an example to allow server to start
29
28
tokio:: time:: sleep ( tokio:: time:: Duration :: from_secs ( 3 ) ) . await ;
30
29
@@ -70,7 +69,8 @@ mod example {
70
69
71
70
#[ cfg( feature = "json" ) ]
72
71
#[ 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 } ;
74
74
select ! {
75
75
r = example:: run_server( ) . fuse( ) => r,
76
76
r = example:: run_client( ) . fuse( ) => r
0 commit comments