Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,23 @@ where
}
}

/// Convert this server to parse a custom preamble `T`.
/// Converts the server to use a custom preamble type for incoming connections.
///
/// Call this before registering preamble callbacks. Calling it later drops any previously configured callbacks.
/// 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::<MyPreamble>();
/// ```
#[must_use]
pub fn with_preamble<T>(self) -> WireframeServer<F, T>
where
Expand Down