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 bevy;
12pub use bincode;
13pub use inventory;
14pub extern crate networker_rs;
15/// Re-export the proc-macros that power sync and messages.
16pub use bevy_networker_multiplayer_macros::{PredictLinearMotion, Velocity2d, netmsg, sync};
17pub use serde;
18
19/// Typed message support and hashing helpers.
20pub mod netmsg;
21/// Network transport and connection management.
22pub mod netres;
23/// Optional client-side prediction support.
24#[cfg(feature = "prediction")]
25pub mod prediction;
26/// Replicated entity marker and plugin wiring.
27pub mod replicated;
28/// Sync registration, snapshotting, and packet application.
29pub mod sync;
30
31/// Trait implemented by messages created with `#[netmsg]`.
32pub use netmsg::NetMessage;
33/// Resource handle for the networking layer.
34pub use netres::NetResource;
35/// Prediction plugin and traits, only available with the feature enabled.
36#[cfg(feature = "prediction")]
37pub use prediction::{LinearMotionPredictionPlugin, PredictLinearMotion, Velocity2d};
38/// Marker component and plugin for replicated entities.
39pub use replicated::{Replicated, ReplicatedPlugin};
40
41/// Returns the published crate name.
42pub fn crate_name() -> &'static str {
43 "bevy-networker-multiplayer"
44}
45
46/// Basic sanity test for the crate identity helper.
47#[cfg(test)]
48mod tests {
49 use super::*;
50
51 #[test]
52 fn returns_crate_name() {
53 assert_eq!(crate_name(), "bevy-networker-multiplayer");
54 }
55}