aboutsummaryrefslogtreecommitdiff
path: root/net/src/connection.rs
diff options
context:
space:
mode:
authorhozan23 <hozan23@proton.me>2023-11-18 13:36:19 +0300
committerhozan23 <hozan23@proton.me>2023-11-19 04:37:50 +0300
commit938b29d418a9df2f93ee273a394f34adc99ea25d (patch)
treef8adfeede7c6f56091ef6a018820fa0b52f38bf3 /net/src/connection.rs
parent0d6c8ad2ed66ff7bd1078be9ea7b582262a12d86 (diff)
net: improve Conn API
Diffstat (limited to 'net/src/connection.rs')
-rw-r--r--net/src/connection.rs10
1 files changed, 5 insertions, 5 deletions
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<Endpoint>;
/// Reads data from this connection.
- async fn recv(&self, buf: &mut [u8]) -> Result<usize>;
+ async fn read(&self, buf: &mut [u8]) -> Result<usize>;
- /// Sends data to this connection
- async fn send(&self, buf: &[u8]) -> Result<usize>;
+ /// Writes data to this connection
+ async fn write(&self, buf: &[u8]) -> Result<usize>;
}
/// 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();
/// };
///
/// ```