@@ -10,7 +10,7 @@ mod handshake;
10
10
pub ( crate ) use handshake:: { IoSession , MidHandshake } ;
11
11
12
12
#[ derive( Debug ) ]
13
- pub enum TlsState {
13
+ pub ( crate ) enum TlsState {
14
14
#[ cfg( feature = "early-data" ) ]
15
15
EarlyData ( usize , Vec < u8 > ) ,
16
16
Stream ,
@@ -21,56 +21,56 @@ pub enum TlsState {
21
21
22
22
impl TlsState {
23
23
#[ inline]
24
- pub fn shutdown_read ( & mut self ) {
24
+ pub ( crate ) fn shutdown_read ( & mut self ) {
25
25
match * self {
26
26
TlsState :: WriteShutdown | TlsState :: FullyShutdown => * self = TlsState :: FullyShutdown ,
27
27
_ => * self = TlsState :: ReadShutdown ,
28
28
}
29
29
}
30
30
31
31
#[ inline]
32
- pub fn shutdown_write ( & mut self ) {
32
+ pub ( crate ) fn shutdown_write ( & mut self ) {
33
33
match * self {
34
34
TlsState :: ReadShutdown | TlsState :: FullyShutdown => * self = TlsState :: FullyShutdown ,
35
35
_ => * self = TlsState :: WriteShutdown ,
36
36
}
37
37
}
38
38
39
39
#[ inline]
40
- pub fn writeable ( & self ) -> bool {
40
+ pub ( crate ) fn writeable ( & self ) -> bool {
41
41
!matches ! ( * self , TlsState :: WriteShutdown | TlsState :: FullyShutdown )
42
42
}
43
43
44
44
#[ inline]
45
- pub fn readable ( & self ) -> bool {
45
+ pub ( crate ) fn readable ( & self ) -> bool {
46
46
!matches ! ( * self , TlsState :: ReadShutdown | TlsState :: FullyShutdown )
47
47
}
48
48
49
49
#[ inline]
50
50
#[ cfg( feature = "early-data" ) ]
51
- pub fn is_early_data ( & self ) -> bool {
51
+ pub ( crate ) fn is_early_data ( & self ) -> bool {
52
52
matches ! ( self , TlsState :: EarlyData ( ..) )
53
53
}
54
54
55
55
#[ inline]
56
56
#[ cfg( not( feature = "early-data" ) ) ]
57
- pub const fn is_early_data ( & self ) -> bool {
57
+ pub ( crate ) const fn is_early_data ( & self ) -> bool {
58
58
false
59
59
}
60
60
}
61
61
62
- pub struct Stream < ' a , IO , C > {
63
- pub io : & ' a mut IO ,
64
- pub session : & ' a mut C ,
65
- pub eof : bool ,
62
+ pub ( crate ) struct Stream < ' a , IO , C > {
63
+ pub ( crate ) io : & ' a mut IO ,
64
+ pub ( crate ) session : & ' a mut C ,
65
+ pub ( crate ) eof : bool ,
66
66
}
67
67
68
68
impl < ' a , IO : AsyncRead + AsyncWrite + Unpin , C , SD > Stream < ' a , IO , C >
69
69
where
70
70
C : DerefMut + Deref < Target = ConnectionCommon < SD > > ,
71
71
SD : SideData ,
72
72
{
73
- pub fn new ( io : & ' a mut IO , session : & ' a mut C ) -> Self {
73
+ pub ( crate ) fn new ( io : & ' a mut IO , session : & ' a mut C ) -> Self {
74
74
Stream {
75
75
io,
76
76
session,
@@ -80,16 +80,16 @@ where
80
80
}
81
81
}
82
82
83
- pub fn set_eof ( mut self , eof : bool ) -> Self {
83
+ pub ( crate ) fn set_eof ( mut self , eof : bool ) -> Self {
84
84
self . eof = eof;
85
85
self
86
86
}
87
87
88
- pub fn as_mut_pin ( & mut self ) -> Pin < & mut Self > {
88
+ pub ( crate ) fn as_mut_pin ( & mut self ) -> Pin < & mut Self > {
89
89
Pin :: new ( self )
90
90
}
91
91
92
- pub fn read_io ( & mut self , cx : & mut Context ) -> Poll < io:: Result < usize > > {
92
+ pub ( crate ) fn read_io ( & mut self , cx : & mut Context ) -> Poll < io:: Result < usize > > {
93
93
let mut reader = SyncReadAdapter { io : self . io , cx } ;
94
94
95
95
let n = match self . session . read_tls ( & mut reader) {
@@ -110,7 +110,7 @@ where
110
110
Poll :: Ready ( Ok ( n) )
111
111
}
112
112
113
- pub fn write_io ( & mut self , cx : & mut Context ) -> Poll < io:: Result < usize > > {
113
+ pub ( crate ) fn write_io ( & mut self , cx : & mut Context ) -> Poll < io:: Result < usize > > {
114
114
let mut writer = SyncWriteAdapter { io : self . io , cx } ;
115
115
116
116
match self . session . write_tls ( & mut writer) {
@@ -119,7 +119,7 @@ where
119
119
}
120
120
}
121
121
122
- pub fn handshake ( & mut self , cx : & mut Context ) -> Poll < io:: Result < ( usize , usize ) > > {
122
+ pub ( crate ) fn handshake ( & mut self , cx : & mut Context ) -> Poll < io:: Result < ( usize , usize ) > > {
123
123
let mut wrlen = 0 ;
124
124
let mut rdlen = 0 ;
125
125
@@ -372,9 +372,9 @@ where
372
372
/// associated [`Context`].
373
373
///
374
374
/// Turns `Poll::Pending` into `WouldBlock`.
375
- pub struct SyncReadAdapter < ' a , ' b , T > {
376
- pub io : & ' a mut T ,
377
- pub cx : & ' a mut Context < ' b > ,
375
+ pub ( crate ) struct SyncReadAdapter < ' a , ' b , T > {
376
+ pub ( crate ) io : & ' a mut T ,
377
+ pub ( crate ) cx : & ' a mut Context < ' b > ,
378
378
}
379
379
380
380
impl < T : AsyncRead + Unpin > Read for SyncReadAdapter < ' _ , ' _ , T > {
@@ -393,9 +393,9 @@ impl<T: AsyncRead + Unpin> Read for SyncReadAdapter<'_, '_, T> {
393
393
/// associated [`Context`].
394
394
///
395
395
/// Turns `Poll::Pending` into `WouldBlock`.
396
- pub struct SyncWriteAdapter < ' a , ' b , T > {
397
- pub io : & ' a mut T ,
398
- pub cx : & ' a mut Context < ' b > ,
396
+ pub ( crate ) struct SyncWriteAdapter < ' a , ' b , T > {
397
+ pub ( crate ) io : & ' a mut T ,
398
+ pub ( crate ) cx : & ' a mut Context < ' b > ,
399
399
}
400
400
401
401
impl < T : Unpin > SyncWriteAdapter < ' _ , ' _ , T > {
0 commit comments