I have the following code:
fn handle_client(mut stream: TcpStream) -> () { let mut buffer = [0; 4096]; stream.read(&mut buffer).expect("read fail"); let path_request: Cow<'_, str> = String::from_utf8_lossy(&buffer[..]);
and I need to decode from ascii, so I am asking for if an analogue of String::from_utf8_lossy() exists for ascii encoding?
I need the code to be alike:
fn handle_client(mut stream: TcpStream) -> () { let mut buffer = [0; 4096]; stream.read(&mut buffer).expect("read fail"); let path_request: Cow<'_, str> = String::from_ascii_lossy(&buffer[..]);
Thanks!