File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -32,3 +32,9 @@ tokio-core = "0.1"
32
32
tokio-io = " 0.1"
33
33
tokio-proto = " 0.1"
34
34
tokio-service = " 0.1"
35
+
36
+ [[example ]]
37
+ name = " basic"
38
+
39
+ [[example ]]
40
+ name = " remote_host"
Original file line number Diff line number Diff line change
1
+ // Copyright 2015-2017 Intecture Developers.
2
+ //
3
+ // Licensed under the Mozilla Public License 2.0 <LICENSE or
4
+ // https://www.tldrlegal.com/l/mpl-2.0>. This file may not be copied,
5
+ // modified, or distributed except according to those terms.
6
+
7
+ extern crate futures;
8
+ extern crate intecture_api;
9
+ extern crate tokio_core;
10
+
11
+ use futures:: Future ;
12
+ use intecture_api:: prelude:: * ;
13
+ use tokio_core:: reactor:: Core ;
14
+
15
+ fn main ( ) {
16
+ let mut core = Core :: new ( ) . unwrap ( ) ;
17
+
18
+ let host = Local :: new ( ) . and_then ( |host| {
19
+ command:: factory ( & host, "whoami" , None ) . and_then ( |mut cmd| {
20
+ cmd. exec ( ) . map ( |out| {
21
+ println ! ( "I'm currently running as {}" , String :: from_utf8_lossy( & out. stdout) . trim( ) ) ;
22
+ } )
23
+ } )
24
+ } ) ;
25
+
26
+ core. run ( host) . unwrap ( ) ;
27
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2015-2017 Intecture Developers.
2
+ //
3
+ // Licensed under the Mozilla Public License 2.0 <LICENSE or
4
+ // https://www.tldrlegal.com/l/mpl-2.0>. This file may not be copied,
5
+ // modified, or distributed except according to those terms.
6
+
7
+ extern crate futures;
8
+ extern crate intecture_api;
9
+ extern crate tokio_core;
10
+
11
+ use futures:: Future ;
12
+ use intecture_api:: prelude:: * ;
13
+ use tokio_core:: reactor:: Core ;
14
+
15
+ fn main ( ) {
16
+ let mut core = Core :: new ( ) . unwrap ( ) ;
17
+ let handle = core. handle ( ) ;
18
+
19
+ let host = Plain :: connect ( "127.0.0.1:7101" , & handle) . map ( |host| {
20
+ println ! ( "Connected to {}" , host. telemetry( ) . hostname) ;
21
+ } ) ;
22
+
23
+ core. run ( host) . unwrap ( ) ;
24
+ }
You can’t perform that action at this time.
0 commit comments