42
42
//! }
43
43
//! ```
44
44
45
- #[ cfg( feature = "use_tokio " ) ]
45
+ #[ cfg( feature = "async-tokio " ) ]
46
46
extern crate futures;
47
47
#[ cfg( feature = "mio-evented" ) ]
48
48
extern crate mio;
49
49
#[ cfg( not( target_os = "wasi" ) ) ]
50
50
extern crate nix;
51
- #[ cfg( feature = "use_tokio " ) ]
51
+ #[ cfg( feature = "async-tokio " ) ]
52
52
extern crate tokio;
53
53
54
54
use std:: fs;
55
55
use std:: fs:: File ;
56
56
use std:: io;
57
57
use std:: io:: prelude:: * ;
58
- #[ cfg( any( target_os = "linux" , target_os = "android" , feature = "use_tokio " ) ) ]
58
+ #[ cfg( any( target_os = "linux" , target_os = "android" , feature = "async-tokio " ) ) ]
59
59
use std:: io:: SeekFrom ;
60
60
#[ cfg( not( target_os = "wasi" ) ) ]
61
61
use std:: os:: unix:: prelude:: * ;
62
62
use std:: path:: Path ;
63
63
64
- #[ cfg( feature = "use_tokio " ) ]
64
+ #[ cfg( feature = "async-tokio " ) ]
65
65
use futures:: { Async , Poll , Stream } ;
66
66
#[ cfg( feature = "mio-evented" ) ]
67
67
use mio:: unix:: EventedFd ;
@@ -71,7 +71,7 @@ use mio::Evented;
71
71
use nix:: sys:: epoll:: * ;
72
72
#[ cfg( not( target_os = "wasi" ) ) ]
73
73
use nix:: unistd:: close;
74
- #[ cfg( feature = "use_tokio " ) ]
74
+ #[ cfg( feature = "async-tokio " ) ]
75
75
use tokio:: reactor:: { Handle , PollEvented } ;
76
76
77
77
pub use error:: Error ;
@@ -126,7 +126,7 @@ fn flush_input_from_file(dev_file: &mut File, max: usize) -> io::Result<usize> {
126
126
}
127
127
128
128
/// Get the pin value from the provided file
129
- #[ cfg( any( target_os = "linux" , target_os = "android" , feature = "use_tokio " ) ) ]
129
+ #[ cfg( any( target_os = "linux" , target_os = "android" , feature = "async-tokio " ) ) ]
130
130
fn get_value_from_file ( dev_file : & mut File ) -> Result < u8 > {
131
131
let mut s = String :: with_capacity ( 10 ) ;
132
132
dev_file. seek ( SeekFrom :: Start ( 0 ) ) ?;
@@ -475,8 +475,8 @@ impl Pin {
475
475
/// The PinStream object can be used with the `tokio` crate. You should probably call
476
476
/// `set_edge()` before using this.
477
477
///
478
- /// This method is only available when the `use_tokio ` crate feature is enabled.
479
- #[ cfg( feature = "use_tokio " ) ]
478
+ /// This method is only available when the `async-tokio ` crate feature is enabled.
479
+ #[ cfg( feature = "async-tokio " ) ]
480
480
pub fn get_stream_with_handle ( & self , handle : & Handle ) -> Result < PinStream > {
481
481
PinStream :: init_with_handle ( * self , handle)
482
482
}
@@ -486,8 +486,8 @@ impl Pin {
486
486
/// The PinStream object can be used with the `tokio` crate. You should probably call
487
487
/// `set_edge()` before using this.
488
488
///
489
- /// This method is only available when the `use_tokio ` crate feature is enabled.
490
- #[ cfg( feature = "use_tokio " ) ]
489
+ /// This method is only available when the `async-tokio ` crate feature is enabled.
490
+ #[ cfg( feature = "async-tokio " ) ]
491
491
pub fn get_stream ( & self ) -> Result < PinStream > {
492
492
PinStream :: init ( * self )
493
493
}
@@ -502,8 +502,8 @@ impl Pin {
502
502
/// it could end up producing the same value multiple times if the value has changed back
503
503
/// between when the interrupt occurred and when the value was read.
504
504
///
505
- /// This method is only available when the `use_tokio ` crate feature is enabled.
506
- #[ cfg( feature = "use_tokio " ) ]
505
+ /// This method is only available when the `async-tokio ` crate feature is enabled.
506
+ #[ cfg( feature = "async-tokio " ) ]
507
507
pub fn get_value_stream_with_handle ( & self , handle : & Handle ) -> Result < PinValueStream > {
508
508
Ok ( PinValueStream ( PinStream :: init_with_handle ( * self , handle) ?) )
509
509
}
@@ -518,8 +518,8 @@ impl Pin {
518
518
/// it could end up producing the same value multiple times if the value has changed back
519
519
/// between when the interrupt occurred and when the value was read.
520
520
///
521
- /// This method is only available when the `use_tokio ` crate feature is enabled.
522
- #[ cfg( feature = "use_tokio " ) ]
521
+ /// This method is only available when the `async-tokio ` crate feature is enabled.
522
+ #[ cfg( feature = "async-tokio " ) ]
523
523
pub fn get_value_stream ( & self ) -> Result < PinValueStream > {
524
524
Ok ( PinValueStream ( PinStream :: init ( * self ) ?) )
525
525
}
@@ -667,13 +667,13 @@ impl Evented for AsyncPinPoller {
667
667
}
668
668
}
669
669
670
- #[ cfg( feature = "use_tokio " ) ]
670
+ #[ cfg( feature = "async-tokio " ) ]
671
671
pub struct PinStream {
672
672
evented : PollEvented < AsyncPinPoller > ,
673
673
skipped_first_event : bool ,
674
674
}
675
675
676
- #[ cfg( feature = "use_tokio " ) ]
676
+ #[ cfg( feature = "async-tokio " ) ]
677
677
impl PinStream {
678
678
pub fn init_with_handle ( pin : Pin , handle : & Handle ) -> Result < Self > {
679
679
Ok ( PinStream {
@@ -683,7 +683,7 @@ impl PinStream {
683
683
}
684
684
}
685
685
686
- #[ cfg( feature = "use_tokio " ) ]
686
+ #[ cfg( feature = "async-tokio " ) ]
687
687
impl PinStream {
688
688
pub fn init ( pin : Pin ) -> Result < Self > {
689
689
Ok ( PinStream {
@@ -693,7 +693,7 @@ impl PinStream {
693
693
}
694
694
}
695
695
696
- #[ cfg( feature = "use_tokio " ) ]
696
+ #[ cfg( feature = "async-tokio " ) ]
697
697
impl Stream for PinStream {
698
698
type Item = ( ) ;
699
699
type Error = Error ;
@@ -714,18 +714,18 @@ impl Stream for PinStream {
714
714
}
715
715
}
716
716
717
- #[ cfg( feature = "use_tokio " ) ]
717
+ #[ cfg( feature = "async-tokio " ) ]
718
718
pub struct PinValueStream ( PinStream ) ;
719
719
720
- #[ cfg( feature = "use_tokio " ) ]
720
+ #[ cfg( feature = "async-tokio " ) ]
721
721
impl PinValueStream {
722
722
#[ inline]
723
723
fn get_value ( & mut self ) -> Result < u8 > {
724
724
get_value_from_file ( & mut self . 0 . evented . get_mut ( ) . devfile )
725
725
}
726
726
}
727
727
728
- #[ cfg( feature = "use_tokio " ) ]
728
+ #[ cfg( feature = "async-tokio " ) ]
729
729
impl Stream for PinValueStream {
730
730
type Item = u8 ;
731
731
type Error = Error ;
0 commit comments