1
0
Fork 0

remove dead code

This commit is contained in:
Sebastien Bourdeauducq 2020-06-05 11:47:36 +08:00
parent aff7c3a40b
commit 8e68e65ca7
1 changed files with 0 additions and 43 deletions

View File

@ -51,25 +51,6 @@ pub async fn read_i32(stream: &TcpStream) -> Result<i32> {
}).await?)
}
pub async fn read_i64(stream: &TcpStream) -> Result<i64> {
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(())
}