From 8e68e65ca761a35950d1cea0bd097bb80fe84ddf Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 5 Jun 2020 11:47:36 +0800 Subject: [PATCH] remove dead code --- src/runtime/src/proto.rs | 43 ---------------------------------------- 1 file changed, 43 deletions(-) diff --git a/src/runtime/src/proto.rs b/src/runtime/src/proto.rs index bd7fa4f4..95c24a30 100644 --- a/src/runtime/src/proto.rs +++ b/src/runtime/src/proto.rs @@ -51,25 +51,6 @@ pub async fn read_i32(stream: &TcpStream) -> Result { }).await?) } -pub async fn read_i64(stream: &TcpStream) -> Result { - Ok(stream.recv(|buf| { - if buf.len() >= 8 { - let value = - ((buf[0] as i64) << 56) - | ((buf[1] as i64) << 48) - | ((buf[2] as i64) << 40) - | ((buf[3] as i64) << 32) - | ((buf[4] as i64) << 24) - | ((buf[5] as i64) << 16) - | ((buf[6] as i64) << 8) - | (buf[7] as i64); - Poll::Ready((8, value)) - } else { - Poll::Pending - } - }).await?) -} - pub async fn read_chunk(stream: &TcpStream, destination: &mut [u8]) -> Result<()> { let total = destination.len(); let destination = RefCell::new(destination); @@ -111,27 +92,3 @@ pub async fn write_i32(stream: &TcpStream, value: i32) -> Result<()> { value as u8].iter().copied()).await?; Ok(()) } - -pub async fn write_i64(stream: &TcpStream, value: i64) -> Result<()> { - stream.send([ - (value >> 56) as u8, - (value >> 48) as u8, - (value >> 40) as u8, - (value >> 32) as u8, - (value >> 24) as u8, - (value >> 16) as u8, - (value >> 8) as u8, - value as u8].iter().copied()).await?; - Ok(()) -} - -pub async fn write_bytes(stream: &TcpStream, value: &[u8]) -> Result<()> { - write_i32(stream, value.len() as i32).await?; - stream.send(value.iter().copied()).await?; - Ok(()) -} - -pub async fn write_string(stream: &TcpStream, value: &str) -> Result<()> { - write_bytes(stream, value.as_bytes()).await?; - Ok(()) -}