]> git.lizzy.rs Git - mt_rudp.git/commitdiff
write_all
authorLizzy Fleckenstein <eliasfleckenstein@web.de>
Sat, 7 Jan 2023 00:18:34 +0000 (01:18 +0100)
committerLizzy Fleckenstein <eliasfleckenstein@web.de>
Sat, 7 Jan 2023 00:18:34 +0000 (01:18 +0100)
examples/example.rs
src/send.rs

index 0a6dc423a9fbb3e48b9825777f5e121f89bd18cc..fc5f1fbc6130e4605cd9cb0e4923d0f942713dd0 100644 (file)
@@ -12,7 +12,7 @@ async fn example(tx: &RudpSender<Client>, rx: &mut RudpReceiver<Client>) -> io::
     pkt.write_u16::<BigEndian>(40)?; // MinProtoVer
     pkt.write_u16::<BigEndian>(40)?; // MaxProtoVer
     pkt.write_u16::<BigEndian>(3)?; // player name length
-    pkt.write(b"foo")?; // player name
+    pkt.write_all(b"foo")?; // player name
 
     tx.send(mt_rudp::Pkt {
         unrel: true,
index 3ec3c64f1f4e248e5e285e9f689677930f483876..741c54211eadda9ba23449768f4cc36a689edd20 100644 (file)
@@ -12,7 +12,6 @@ impl<S: UdpSender> RudpSender<S> {
 }
 
 impl<S: UdpSender> RudpShare<S> {
-    #[allow(clippy::unused_io_amount)]
     pub async fn send(&self, tp: PktType, pkt: Pkt<&[u8]>) -> AckResult {
         let mut buf = Vec::with_capacity(4 + 2 + 1 + 1 + 2 + 1 + pkt.data.len());
         buf.write_u32::<BigEndian>(PROTO_ID)?;
@@ -28,7 +27,7 @@ impl<S: UdpSender> RudpShare<S> {
         }
 
         buf.write_u8(tp as u8)?;
-        buf.write(pkt.data)?;
+        buf.write_all(pkt.data)?;
 
         self.send_raw(&buf).await?;