Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
UkoeHB committed Feb 8, 2025
1 parent 6c44195 commit b9efeea
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ Cargo.lock
/.idea
.vscode
.rustc_info.json
.notes
wasm32-unknown-unknown
renet2/debug
2 changes: 2 additions & 0 deletions renet2_setup/src/common/connection_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ pub enum ConnectionType {

impl ConnectionType {
/// Infers the connection type from the environment.
///
/// If in WASM and the `wt_client_transport` feature is not enabled, always falls back to [`Self::WasmWs`].
pub fn inferred() -> Self {
#[cfg(not(target_family = "wasm"))]
{
Expand Down
4 changes: 3 additions & 1 deletion renet2_setup/src/common/server_connect_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ pub fn connect_token_from_bytes(connect_token_bytes: &Vec<u8>) -> Result<Connect
//-------------------------------------------------------------------------------------------------------------------

/// A token that a client can use to connect to a renet2 server.
///
/// Produced by [`ConnectMetas::new_connect_token`] and consumed by `ClientConnectPack::new`.
//todo: how to serialize the connect token more directly to reduce allocations?
#[serde_as]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ServerConnectToken {
Native {
/// A renet2 `ConnectToken`.
/// A renet2 [`ConnectToken`].
#[serde_as(as = "Bytes")]
token: Vec<u8>,
},
Expand Down
4 changes: 4 additions & 0 deletions renet2_setup/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![allow(rustdoc::redundant_explicit_links)]
#![doc = include_str!("../README.md")]
#[allow(unused_imports)]
use crate as renet2_setup;

#[cfg(feature = "client")]
pub mod client;
Expand Down
4 changes: 4 additions & 0 deletions renet2_setup/src/server/client_counts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ use crate::common::ConnectionType;
//-------------------------------------------------------------------------------------------------------------------

/// The number of clients that will connect to a server with different connection types.
///
/// Used by [`setup_combo_renet2_server`] to set max-client limits and determine what server sockets are required.
/// Note that we assume clients will not change connection type throughout a game. If you want to allow clients
/// to change connection type, then set each count below equal to the total number of clients.
#[derive(Debug, Default, Clone)]
pub struct ClientCounts {
/// The ids of in-memory clients that will connect.
Expand Down

0 comments on commit b9efeea

Please sign in to comment.