Skip to content

Commit 14707d7

Browse files
committed
Remove Packet::into_bytes and add Packet::to_bytes
1 parent 8137eb9 commit 14707d7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/packet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<'a> Packet<'a> {
116116
buf.put_u16(block_id);
117117
}
118118

119-
pub(crate) fn into_bytes(self) -> Bytes {
119+
pub(crate) fn to_bytes(&self) -> Bytes {
120120
let mut buf = BytesMut::new();
121121
self.encode(&mut buf);
122122
buf.freeze()

src/server/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ async fn send_error(error: Error, peer: SocketAddr) -> Result<()> {
150150
let addr: SocketAddr = "0.0.0.0:0".parse().unwrap();
151151
let socket = Async::<UdpSocket>::bind(addr).map_err(Error::Bind)?;
152152

153-
let data = Packet::Error(error.into()).into_bytes();
153+
let data = Packet::Error(error.into()).to_bytes();
154154
socket.send_to(&data[..], peer).await?;
155155

156156
Ok(())

0 commit comments

Comments
 (0)