Make write() consume the objects.

This commit is contained in:
2022-05-14 20:37:18 -07:00
parent c8279cfc5f
commit 277125e1a0
9 changed files with 15 additions and 14 deletions

View File

@@ -72,7 +72,7 @@ impl ClientGreeting {
}
pub async fn write<W: AsyncWrite + Send + Unpin>(
&self,
mut self,
w: &mut W,
) -> Result<(), ClientGreetingWriteError> {
if self.acceptable_methods.len() > 255 {
@@ -85,7 +85,7 @@ impl ClientGreeting {
buffer.push(5);
buffer.push(self.acceptable_methods.len() as u8);
w.write_all(&buffer).await?;
for authmeth in self.acceptable_methods.iter() {
for authmeth in self.acceptable_methods.drain(..) {
authmeth.write(w).await?;
}
Ok(())