File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ repository = "https://github.com/oblique/async-tftp-rs"
1616
1717[dependencies ]
1818thiserror = " 1.0.22"
19- bytes = " 0.6 .0"
19+ bytes = " 1.0 .0"
2020nom = " 6.0.1"
2121num-derive = " 0.3.3"
2222num-traits = " 0.2.14"
Original file line number Diff line number Diff line change 1- #![ allow( clippy:: transmute_ptr_to_ptr) ]
2-
31use async_io:: Async ;
42use bytes:: { BufMut , Bytes , BytesMut } ;
53use futures_lite:: { AsyncRead , AsyncReadExt } ;
64use log:: trace;
75use std:: cmp;
86use std:: io;
9- use std:: mem;
107use std:: net:: { SocketAddr , UdpSocket } ;
8+ use std:: slice;
119use std:: time:: Duration ;
1210
1311use crate :: error:: { Error , Result } ;
9997
10098 // Read block in self.buffer
10199 let buf = unsafe {
102- let data_buf: & mut [ u8 ] =
103- mem:: transmute ( self . buffer . bytes_mut ( ) ) ;
100+ let uninit_buf = self . buffer . chunk_mut ( ) ;
101+
102+ let data_buf = slice:: from_raw_parts_mut (
103+ uninit_buf. as_mut_ptr ( ) ,
104+ uninit_buf. len ( ) ,
105+ ) ;
104106
105107 let len = self . read_block ( data_buf) . await ?;
106108 is_last_block = len < self . block_size ;
You can’t perform that action at this time.
0 commit comments