@@ -4,7 +4,6 @@ use crate::errno::Errno;
44use crate :: Result ;
55use libc:: { self , c_int, c_void, off_t, size_t} ;
66use std:: io:: { IoSlice , IoSliceMut } ;
7- use std:: marker:: PhantomData ;
87use std:: os:: unix:: io:: RawFd ;
98
109/// Low-level vectored write to a raw file descriptor
@@ -145,77 +144,6 @@ pub struct RemoteIoVec {
145144 pub len : usize ,
146145}
147146
148- /// A vector of buffers.
149- ///
150- /// Vectored I/O methods like [`writev`] and [`readv`] use this structure for
151- /// both reading and writing. Each `IoVec` specifies the base address and
152- /// length of an area in memory.
153- #[ deprecated(
154- since = "0.24.0" ,
155- note = "`IoVec` is no longer used in the public interface, use `IoSlice` or `IoSliceMut` instead"
156- ) ]
157- #[ repr( transparent) ]
158- #[ allow( renamed_and_removed_lints) ]
159- #[ allow( clippy:: unknown_clippy_lints) ]
160- // Clippy false positive: https://github.com/rust-lang/rust-clippy/issues/8867
161- #[ allow( clippy:: derive_partial_eq_without_eq) ]
162- #[ derive( Clone , Copy , Debug , Eq , Hash , PartialEq ) ]
163- pub struct IoVec < T > ( pub ( crate ) libc:: iovec , PhantomData < T > ) ;
164-
165- #[ allow( deprecated) ]
166- impl < T > IoVec < T > {
167- /// View the `IoVec` as a Rust slice.
168- #[ deprecated(
169- since = "0.24.0" ,
170- note = "Use the `Deref` impl of `IoSlice` or `IoSliceMut` instead"
171- ) ]
172- #[ inline]
173- pub fn as_slice ( & self ) -> & [ u8 ] {
174- use std:: slice;
175-
176- unsafe {
177- slice:: from_raw_parts ( self . 0 . iov_base as * const u8 , self . 0 . iov_len )
178- }
179- }
180- }
181-
182- #[ allow( deprecated) ]
183- impl < ' a > IoVec < & ' a [ u8 ] > {
184- /// Create an `IoVec` from a Rust slice.
185- #[ deprecated( since = "0.24.0" , note = "Use `IoSlice::new` instead" ) ]
186- pub fn from_slice ( buf : & ' a [ u8 ] ) -> IoVec < & ' a [ u8 ] > {
187- IoVec (
188- libc:: iovec {
189- iov_base : buf. as_ptr ( ) as * mut c_void ,
190- iov_len : buf. len ( ) as size_t ,
191- } ,
192- PhantomData ,
193- )
194- }
195- }
196-
197- #[ allow( deprecated) ]
198- impl < ' a > IoVec < & ' a mut [ u8 ] > {
199- /// Create an `IoVec` from a mutable Rust slice.
200- #[ deprecated( since = "0.24.0" , note = "Use `IoSliceMut::new` instead" ) ]
201- pub fn from_mut_slice ( buf : & ' a mut [ u8 ] ) -> IoVec < & ' a mut [ u8 ] > {
202- IoVec (
203- libc:: iovec {
204- iov_base : buf. as_ptr ( ) as * mut c_void ,
205- iov_len : buf. len ( ) as size_t ,
206- } ,
207- PhantomData ,
208- )
209- }
210- }
211-
212- // The only reason IoVec isn't automatically Send+Sync is because libc::iovec
213- // contains raw pointers.
214- #[ allow( deprecated) ]
215- unsafe impl < T > Send for IoVec < T > where T : Send { }
216- #[ allow( deprecated) ]
217- unsafe impl < T > Sync for IoVec < T > where T : Sync { }
218-
219147feature ! {
220148#![ feature = "process" ]
221149
0 commit comments