From 59151df02963d381d4195b94488a7be42689246c Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 1 Dec 2021 13:28:02 +0100 Subject: [PATCH] Use Vec instead of BytesMut There doesn't seem to be any particular advantage to using BytesMut here. --- epp-client/Cargo.toml | 1 - epp-client/src/connection/registry.rs | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/epp-client/Cargo.toml b/epp-client/Cargo.toml index d113b7e..0db6fac 100644 --- a/epp-client/Cargo.toml +++ b/epp-client/Cargo.toml @@ -11,7 +11,6 @@ repository = "https://github.com/masalachai/epp-client" [dependencies] epp-client-macros = { version = "0.1", path = "../epp-client-macros" } -bytes = "1" chrono = "0.4" env_logger = "0.9" log = "0.4" diff --git a/epp-client/src/connection/registry.rs b/epp-client/src/connection/registry.rs index db3e3cc..8729ad9 100644 --- a/epp-client/src/connection/registry.rs +++ b/epp-client/src/connection/registry.rs @@ -1,6 +1,5 @@ //! Manages registry connections and reading/writing to them -use bytes::BytesMut; use rustls::{OwnedTrustAnchor, RootCertStore}; use std::convert::TryInto; use std::sync::Arc; @@ -66,7 +65,7 @@ impl EppConnection { let message_size = buf_size - 4; debug!("{}: Response buffer size: {}", self.registry, message_size); - let mut buf = BytesMut::with_capacity(4096); + let mut buf = Vec::with_capacity(4096); let mut read_buf = vec![0u8; 4096]; let mut read_size: usize = 0; @@ -86,9 +85,7 @@ impl EppConnection { } } - let data = buf.to_vec(); - - Ok(data) + Ok(buf) } /// Receives response from the socket and converts it into an EPP XML string