From 8c0f6a392f387df51cc4cb23c6ca1798877d67e7 Mon Sep 17 00:00:00 2001 From: Aaron Kelbsch Date: Thu, 4 Sep 2025 15:15:00 +0200 Subject: [PATCH] docs: add guarantees to the read and send_datagram function --- quinn/src/connection.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/quinn/src/connection.rs b/quinn/src/connection.rs index ab3777d713..587f49fe9b 100644 --- a/quinn/src/connection.rs +++ b/quinn/src/connection.rs @@ -346,6 +346,10 @@ impl Connection { } /// Receive an application datagram + /// + /// Guarantees: + /// - Cancel-safe future + /// - First poll resolves immediately if a datagram is available pub fn read_datagram(&self) -> ReadDatagram<'_> { ReadDatagram { conn: &self.0, @@ -430,6 +434,10 @@ impl Connection { /// /// Previously queued datagrams which are still unsent may be discarded to make space for this /// datagram, in order of oldest to newest. + /// + /// Guarantees: + /// - Cancel-safe future + /// - First poll resolves immediately if given datagram can be sent pub fn send_datagram(&self, data: Bytes) -> Result<(), SendDatagramError> { let conn = &mut *self.0.state.lock("send_datagram"); if let Some(ref x) = conn.error {