@@ -45,7 +45,11 @@ pub fn readv<Fd: AsFd>(fd: Fd, iov: &mut [IoSliceMut<'_>]) -> Result<usize> {
4545/// See also: [`writev`](fn.writev.html) and [`pwrite`](fn.pwrite.html)
4646#[ cfg( not( any( target_os = "redox" , target_os = "haiku" ) ) ) ]
4747#[ cfg_attr( docsrs, doc( cfg( all( ) ) ) ) ]
48- pub fn pwritev < Fd : AsFd > ( fd : Fd , iov : & [ IoSlice < ' _ > ] , offset : off_t ) -> Result < usize > {
48+ pub fn pwritev < Fd : AsFd , Off : Into < off_t > > (
49+ fd : Fd ,
50+ iov : & [ IoSlice < ' _ > ] ,
51+ offset : Off ,
52+ ) -> Result < usize > {
4953 #[ cfg( target_env = "uclibc" ) ]
5054 let offset = offset as libc:: off64_t ; // uclibc doesn't use off_t
5155
@@ -55,7 +59,7 @@ pub fn pwritev<Fd: AsFd>(fd: Fd, iov: &[IoSlice<'_>], offset: off_t) -> Result<u
5559 fd. as_fd ( ) . as_raw_fd ( ) ,
5660 iov. as_ptr ( ) as * const libc:: iovec ,
5761 iov. len ( ) as c_int ,
58- offset,
62+ offset. into ( ) ,
5963 )
6064 } ;
6165
@@ -71,10 +75,10 @@ pub fn pwritev<Fd: AsFd>(fd: Fd, iov: &[IoSlice<'_>], offset: off_t) -> Result<u
7175/// See also: [`readv`](fn.readv.html) and [`pread`](fn.pread.html)
7276#[ cfg( not( any( target_os = "redox" , target_os = "haiku" ) ) ) ]
7377#[ cfg_attr( docsrs, doc( cfg( all( ) ) ) ) ]
74- pub fn preadv < Fd : AsFd > (
78+ pub fn preadv < Fd : AsFd , Off : Into < off_t > > (
7579 fd : Fd ,
7680 iov : & mut [ IoSliceMut < ' _ > ] ,
77- offset : off_t ,
81+ offset : Off ,
7882) -> Result < usize > {
7983 #[ cfg( target_env = "uclibc" ) ]
8084 let offset = offset as libc:: off64_t ; // uclibc doesn't use off_t
@@ -85,7 +89,7 @@ pub fn preadv<Fd: AsFd>(
8589 fd. as_fd ( ) . as_raw_fd ( ) ,
8690 iov. as_ptr ( ) as * const libc:: iovec ,
8791 iov. len ( ) as c_int ,
88- offset,
92+ offset. into ( ) ,
8993 )
9094 } ;
9195
@@ -96,13 +100,17 @@ pub fn preadv<Fd: AsFd>(
96100///
97101/// See also [pwrite(2)](https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html)
98102// TODO: move to unistd
99- pub fn pwrite < Fd : AsFd > ( fd : Fd , buf : & [ u8 ] , offset : off_t ) -> Result < usize > {
103+ pub fn pwrite < Fd : AsFd , Off : Into < off_t > > (
104+ fd : Fd ,
105+ buf : & [ u8 ] ,
106+ offset : Off ,
107+ ) -> Result < usize > {
100108 let res = unsafe {
101109 largefile_fn ! [ pwrite] (
102110 fd. as_fd ( ) . as_raw_fd ( ) ,
103111 buf. as_ptr ( ) as * const c_void ,
104112 buf. len ( ) as size_t ,
105- offset,
113+ offset. into ( ) ,
106114 )
107115 } ;
108116
@@ -113,13 +121,17 @@ pub fn pwrite<Fd: AsFd>(fd: Fd, buf: &[u8], offset: off_t) -> Result<usize> {
113121///
114122/// See also [pread(2)](https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html)
115123// TODO: move to unistd
116- pub fn pread < Fd : AsFd > ( fd : Fd , buf : & mut [ u8 ] , offset : off_t ) -> Result < usize > {
124+ pub fn pread < Fd : AsFd , Off : Into < off_t > > (
125+ fd : Fd ,
126+ buf : & mut [ u8 ] ,
127+ offset : Off ,
128+ ) -> Result < usize > {
117129 let res = unsafe {
118130 largefile_fn ! [ pread] (
119131 fd. as_fd ( ) . as_raw_fd ( ) ,
120132 buf. as_mut_ptr ( ) as * mut c_void ,
121133 buf. len ( ) as size_t ,
122- offset,
134+ offset. into ( ) ,
123135 )
124136 } ;
125137
0 commit comments