diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 718b60b..aa27b52 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1292,6 +1292,11 @@ impl AsyncProtocolReader { } } } + + /// Consume the protocol reader in exchange for the underlying packet decoder. + pub fn decoder(self) -> PacketReader { + return self.packet_reader; + } } /// Manages an async buffer to automatically encrypt and send contents in packets. @@ -1328,6 +1333,11 @@ impl AsyncProtocolWriter { buffer.flush().await?; Ok(()) } + + /// Consume the protocol writer in exchange for the underlying packet encoder. + pub fn encoder(self) -> PacketWriter { + return self.packet_writer; + } } #[cfg(test)]