yog-network 0.1.0

Yog networking — raw-byte packets over channels (no NBT on the wire).
Documentation
  • Coverage
  • 66.67%
    8 out of 12 items documented2 out of 9 items with examples
  • Size
  • Source code size: 6.6 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 373.23 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 5s Average build duration of successful builds.
  • all releases: 5s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • F000NKKK

Networking — custom packets as raw bytes over named channels.

Yog never puts NBT on the wire: a packet payload is just Vec<u8>, so mod authors serialize with whatever is fastest for them (bincode, protobuf, FlatBuffers, plain bytes). NBT is only ever built when something must be handed to the game itself.

For ergonomic typed packets, use the [packet!] macro:

use yog_network::{packet, Packet};

packet! {
    pub struct TeleportPacket {
        x: f64,
        y: f64,
        z: f64,
        player: String,
    }
}

let pkt = TeleportPacket { x: 0.0, y: 64.0, z: 0.0, player: "Steve".into() };
let bytes = pkt.encode();
let decoded = TeleportPacket::decode(&bytes).unwrap();
assert_eq!(decoded.player, "Steve");