@@ -68,27 +68,81 @@ impl Read for Empty {
68
68
fn read_buf ( & mut self , _cursor : BorrowedCursor < ' _ > ) -> io:: Result < ( ) > {
69
69
Ok ( ( ) )
70
70
}
71
+
72
+ #[ inline]
73
+ fn read_vectored ( & mut self , _bufs : & mut [ IoSliceMut < ' _ > ] ) -> io:: Result < usize > {
74
+ Ok ( 0 )
75
+ }
76
+
77
+ #[ inline]
78
+ fn is_read_vectored ( & self ) -> bool {
79
+ true
80
+ }
81
+
82
+ #[ inline]
83
+ fn read_exact ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < ( ) > {
84
+ if !buf. is_empty ( ) { Err ( io:: Error :: READ_EXACT_EOF ) } else { Ok ( ( ) ) }
85
+ }
86
+
87
+ #[ inline]
88
+ fn read_buf_exact ( & mut self , cursor : BorrowedCursor < ' _ > ) -> io:: Result < ( ) > {
89
+ if cursor. capacity ( ) != 0 { Err ( io:: Error :: READ_EXACT_EOF ) } else { Ok ( ( ) ) }
90
+ }
91
+
92
+ #[ inline]
93
+ fn read_to_end ( & mut self , _buf : & mut Vec < u8 > ) -> io:: Result < usize > {
94
+ Ok ( 0 )
95
+ }
96
+
97
+ #[ inline]
98
+ fn read_to_string ( & mut self , _buf : & mut String ) -> io:: Result < usize > {
99
+ Ok ( 0 )
100
+ }
71
101
}
72
102
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
73
103
impl BufRead for Empty {
74
104
#[ inline]
75
105
fn fill_buf ( & mut self ) -> io:: Result < & [ u8 ] > {
76
106
Ok ( & [ ] )
77
107
}
108
+
78
109
#[ inline]
79
110
fn consume ( & mut self , _n : usize ) { }
111
+
112
+ #[ inline]
113
+ fn has_data_left ( & mut self ) -> io:: Result < bool > {
114
+ Ok ( false )
115
+ }
116
+
117
+ #[ inline]
118
+ fn read_until ( & mut self , _byte : u8 , _buf : & mut Vec < u8 > ) -> io:: Result < usize > {
119
+ Ok ( 0 )
120
+ }
121
+
122
+ #[ inline]
123
+ fn skip_until ( & mut self , _byte : u8 ) -> io:: Result < usize > {
124
+ Ok ( 0 )
125
+ }
126
+
127
+ #[ inline]
128
+ fn read_line ( & mut self , _buf : & mut String ) -> io:: Result < usize > {
129
+ Ok ( 0 )
130
+ }
80
131
}
81
132
82
133
#[ stable( feature = "empty_seek" , since = "1.51.0" ) ]
83
134
impl Seek for Empty {
135
+ #[ inline]
84
136
fn seek ( & mut self , _pos : SeekFrom ) -> io:: Result < u64 > {
85
137
Ok ( 0 )
86
138
}
87
139
140
+ #[ inline]
88
141
fn stream_len ( & mut self ) -> io:: Result < u64 > {
89
142
Ok ( 0 )
90
143
}
91
144
145
+ #[ inline]
92
146
fn stream_position ( & mut self ) -> io:: Result < u64 > {
93
147
Ok ( 0 )
94
148
}
@@ -119,6 +173,16 @@ impl Write for Empty {
119
173
true
120
174
}
121
175
176
+ #[ inline]
177
+ fn write_all ( & mut self , _buf : & [ u8 ] ) -> io:: Result < ( ) > {
178
+ Ok ( ( ) )
179
+ }
180
+
181
+ #[ inline]
182
+ fn write_all_vectored ( & mut self , _bufs : & mut [ IoSlice < ' _ > ] ) -> io:: Result < ( ) > {
183
+ Ok ( ( ) )
184
+ }
185
+
122
186
#[ inline]
123
187
fn flush ( & mut self ) -> io:: Result < ( ) > {
124
188
Ok ( ( ) )
@@ -143,6 +207,16 @@ impl Write for &Empty {
143
207
true
144
208
}
145
209
210
+ #[ inline]
211
+ fn write_all ( & mut self , _buf : & [ u8 ] ) -> io:: Result < ( ) > {
212
+ Ok ( ( ) )
213
+ }
214
+
215
+ #[ inline]
216
+ fn write_all_vectored ( & mut self , _bufs : & mut [ IoSlice < ' _ > ] ) -> io:: Result < ( ) > {
217
+ Ok ( ( ) )
218
+ }
219
+
146
220
#[ inline]
147
221
fn flush ( & mut self ) -> io:: Result < ( ) > {
148
222
Ok ( ( ) )
@@ -302,6 +376,16 @@ impl Write for Sink {
302
376
true
303
377
}
304
378
379
+ #[ inline]
380
+ fn write_all ( & mut self , _buf : & [ u8 ] ) -> io:: Result < ( ) > {
381
+ Ok ( ( ) )
382
+ }
383
+
384
+ #[ inline]
385
+ fn write_all_vectored ( & mut self , _bufs : & mut [ IoSlice < ' _ > ] ) -> io:: Result < ( ) > {
386
+ Ok ( ( ) )
387
+ }
388
+
305
389
#[ inline]
306
390
fn flush ( & mut self ) -> io:: Result < ( ) > {
307
391
Ok ( ( ) )
@@ -326,6 +410,21 @@ impl Write for &Sink {
326
410
true
327
411
}
328
412
413
+ #[ inline]
414
+ fn write_all ( & mut self , _buf : & [ u8 ] ) -> io:: Result < ( ) > {
415
+ Ok ( ( ) )
416
+ }
417
+
418
+ #[ inline]
419
+ fn write_all_vectored ( & mut self , _bufs : & mut [ IoSlice < ' _ > ] ) -> io:: Result < ( ) > {
420
+ Ok ( ( ) )
421
+ }
422
+
423
+ #[ inline]
424
+ fn write_fmt ( & mut self , _fmt : fmt:: Arguments < ' _ > ) -> io:: Result < ( ) > {
425
+ Ok ( ( ) )
426
+ }
427
+
329
428
#[ inline]
330
429
fn flush ( & mut self ) -> io:: Result < ( ) > {
331
430
Ok ( ( ) )
0 commit comments