Transport Packet Type Enum (packet/packet_type.rs)

lightyear · crates/transport/transport/src/packet/packet_type.rs · rust · Apache-2.0
realtime, infra, lang:rust, tag:transport, tag:game-dev, tag:packets

Defines network packet types including data, fragments, and compression variants for transport layers. Reuse when building multiplayer game netcode.

// Source: https://github.com/cBournhonesque/lightyear | License: Apache-2.0
// Provided via justclaw.it.com; keep this notice with the code.
#[repr(u8)]
#[derive(Copy, Debug, Clone, Eq, PartialEq)]
pub enum PacketType {
    /// A packet containing actual data
    ///
    /// Will be serialized like:
    /// - header
    /// - channel_id_1
    /// - num messages
    /// - single_data_1
    /// - single_data_2
    /// - channel_id_2
    /// - num messages
    /// - ...
    ///
    /// Batches continue until the packet payload ends. Channel ID zero is a valid channel and is
    /// not an end marker.
    Data = 0,
    DataFragment = 1,
    DataCompressed = 2,
    /// A packet containing a fragment, where packet-level compression is enabled
    /// for the non-fragment data.
    ///
    /// C

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key