bevy_networker_multiplayer/lib.rs
1// SPDX-License-Identifier: MIT
2//! Library entry point for `bevy-networker-multiplayer`.
3//!
4//! This crate keeps the public API intentionally small:
5//! - `NetResource` gives access to the underlying socket layer.
6//! - `Replicated` marks entities that should exist on every peer.
7//! - `#[sync]` marks components and resources that should replicate.
8//! - `#[netmsg]` marks typed messages for request/response style traffic.
9//! - Optional prediction helpers live behind the `prediction` feature.
10
11pub use bincode;
12pub use bevy;
13pub use inventory;
14pub extern crate networker_rs;
15pub use serde;
16/// Re-export the proc-macros that power sync and messages.
17pub use bevy_networker_multiplayer_macros::{
18 netmsg, sync, PredictLinearMotion, Velocity2d,
19};
20
21/// Network transport and connection management.
22pub mod netres;
23/// Typed message support and hashing helpers.
24pub mod netmsg;
25/// Replicated entity marker and plugin wiring.
26pub mod replicated;
27/// Optional client-side prediction support.
28#[cfg(feature = "prediction")]
29pub mod prediction;
30/// Sync registration, snapshotting, and packet application.
31pub mod sync;
32
33/// Resource handle for the networking layer.
34pub use netres::NetResource;
35/// Trait implemented by messages created with `#[netmsg]`.
36pub use netmsg::NetMessage;
37/// Marker component and plugin for replicated entities.
38pub use replicated::{Replicated, ReplicatedPlugin};
39/// Prediction plugin and traits, only available with the feature enabled.
40#[cfg(feature = "prediction")]
41pub use prediction::{
42 LinearMotionPredictionPlugin,
43 PredictLinearMotion,
44 Velocity2d,
45};
46
47/// Returns the published crate name.
48pub fn crate_name() -> &'static str {
49 "bevy-networker-multiplayer"
50}
51
52/// Basic sanity test for the crate identity helper.
53#[cfg(test)]
54mod tests {
55 use super::*;
56
57 #[test]
58 fn returns_crate_name() {
59 assert_eq!(crate_name(), "bevy-networker-multiplayer");
60 }
61}