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:
parent
685e60387e
commit
85c1014f86
|
@ -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)
|
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)))* {
|
if true $(&& ($cond(&self)))* {
|
||||||
self.$field.write_to(buf)?;
|
self.$field.write_to(buf)?;
|
||||||
|
@ -1387,5 +1387,5 @@ impl Clone for Conn {
|
||||||
pub trait PacketType {
|
pub trait PacketType {
|
||||||
fn packet_id(&self, protocol_version: i32) -> i32;
|
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>;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue