Don't consume self when writing packet to a writer. Mutability is not affected (#375)

* Minor change: Don't consume self when writing packet to a writer. Mutability is not affected.

* Further decrease packet write requirements

Co-authored-by: Terminator <terminator@nonexistent.com>
This commit is contained in:
Terminator 2020-10-10 04:36:55 +02:00 committed by GitHub
parent 685e60387e
commit 85c1014f86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -119,7 +119,7 @@ macro_rules! state_packets {
packet::versions::translate_internal_packet_id_for_version(version, State::$stateName, Direction::$dirName, internal_ids::$name, false)
}
fn write<W: io::Write>(self, buf: &mut W) -> Result<(), Error> {
fn write<W: io::Write>(&self, buf: &mut W) -> Result<(), Error> {
$(
if true $(&& ($cond(&self)))* {
self.$field.write_to(buf)?;
@ -1387,5 +1387,5 @@ impl Clone for Conn {
pub trait PacketType {
fn packet_id(&self, protocol_version: i32) -> i32;
fn write<W: io::Write>(self, buf: &mut W) -> Result<(), Error>;
fn write<W: io::Write>(&self, buf: &mut W) -> Result<(), Error>;
}