From d6acea2c1a5167ab95906f8e8e3c0666814930c4 Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Sun, 15 Jun 2025 09:32:38 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=93=9D=20Add=20docstrings=20to=20`cod?= =?UTF-8?q?ex/fix-callback-handler-reset-in-with=5Fpreamble`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docstrings generation was requested by @leynos. * https://github.com/leynos/wireframe/pull/45#issuecomment-2973591635 The following files were modified: * `src/server.rs` --- src/server.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/server.rs b/src/server.rs index 84ab1d67..512faeea 100644 --- a/src/server.rs +++ b/src/server.rs @@ -90,6 +90,23 @@ where /// /// Call this before registering preamble callbacks. Calling it later drops any previously configured callbacks. #[must_use] + /// Converts the server to use a custom preamble type for incoming connections. + /// + /// Calling this method will drop any previously configured preamble decode callbacks. Use it before registering preamble handlers if you wish to retain them. + /// + /// # Type Parameters + /// + /// * `T` – The type to decode as the connection preamble; must implement `bincode::Decode<()>`, `Send`, and `'static`. + /// + /// # Returns + /// + /// A new `WireframeServer` instance configured to decode preambles of type `T`. + /// + /// # Examples + /// + /// ``` + /// let server = WireframeServer::new(factory).with_preamble::(); + /// ``` pub fn with_preamble(self) -> WireframeServer where // Unit context indicates no external state is required when decoding. From eef5a4f8433738ffed179f7b90ec4c97da410262 Mon Sep 17 00:00:00 2001 From: Leynos Date: Sun, 15 Jun 2025 10:42:38 +0100 Subject: [PATCH 2/2] Tidy docstring --- src/server.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/server.rs b/src/server.rs index 512faeea..a8c61b13 100644 --- a/src/server.rs +++ b/src/server.rs @@ -86,10 +86,6 @@ where } } - /// Convert this server to parse a custom preamble `T`. - /// - /// Call this before registering preamble callbacks. Calling it later drops any previously configured callbacks. - #[must_use] /// Converts the server to use a custom preamble type for incoming connections. /// /// Calling this method will drop any previously configured preamble decode callbacks. Use it before registering preamble handlers if you wish to retain them. @@ -107,6 +103,7 @@ where /// ``` /// let server = WireframeServer::new(factory).with_preamble::(); /// ``` + #[must_use] pub fn with_preamble(self) -> WireframeServer where // Unit context indicates no external state is required when decoding.