From 938b29d418a9df2f93ee273a394f34adc99ea25d Mon Sep 17 00:00:00 2001 From: hozan23 Date: Sat, 18 Nov 2023 13:36:19 +0300 Subject: net: improve Conn API --- net/src/connection.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'net/src/connection.rs') diff --git a/net/src/connection.rs b/net/src/connection.rs index 518ccfd..53bcdeb 100644 --- a/net/src/connection.rs +++ b/net/src/connection.rs @@ -20,10 +20,10 @@ pub trait Connection: Send + Sync { fn local_endpoint(&self) -> Result; /// Reads data from this connection. - async fn recv(&self, buf: &mut [u8]) -> Result; + async fn read(&self, buf: &mut [u8]) -> Result; - /// Sends data to this connection - async fn send(&self, buf: &[u8]) -> Result; + /// Writes data to this connection + async fn write(&self, buf: &[u8]) -> Result; } /// Connects to the provided endpoint. @@ -40,10 +40,10 @@ pub trait Connection: Send + Sync { /// /// let conn = dial(&endpoint).await.unwrap(); /// -/// conn.send(b"MSG").await.unwrap(); +/// conn.write(b"MSG").await.unwrap(); /// /// let mut buffer = [0;32]; -/// conn.recv(&mut buffer).await.unwrap(); +/// conn.read(&mut buffer).await.unwrap(); /// }; /// /// ``` -- cgit v1.2.3