1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! Allows converting between [`bevy_replicon`] and [`crate`] types.
use ;
// Entity <-> ClientId
/// Converts an [`Entity`] into a [`ClientId`].
///
/// [`bevy_replicon`] requires a [`ClientId`] to identify clients connected to a
/// server. To satisfy this, we use the raw [`u64`] of the [`Entity`] session as
/// the [`ClientId`]. This means that once a client session [`Entity`] has been
/// created, only that entity alone must refer to that client for the rest of
/// the client's lifetime.
///
/// See [`to_entity`].
pub const
/// Attempts to convert a [`ClientId`] into an [`Entity`].
///
/// Returns [`None`] if the client ID does not represent a valid entity.
/// Any value created from [`to_client_id`] will be valid for this function.
///
/// See [`to_client_id`].
// ChannelKind -> LaneKind
/// Converts a [`ChannelKind`] into a [`LaneKind`].
///
/// This is a lossless conversion, since [`LaneKind`] has more variants than
/// [`ChannelKind`]. However, converting a [`LaneKind`] into a [`ChannelKind`]
/// may be lossy, so is not defined.
pub const
// LaneIndex <-> channel ID
/// Attempts to convert a [`LaneIndex`] to a channel ID.
///
/// [`aeronet_transport`]'s lanes and [`bevy_replicon`]'s channels serve a very
/// similar purpose, so we can map between lane indices and channel IDs
/// directly - as long as the [`LaneIndex`] is equal to or below [`u8::MAX`].
///
/// Returns [`None`] if this [`LaneIndex`] cannot fit into a [`u8`].
///
/// See [`to_lane_index`].
/// Converts a channel ID into a [`LaneIndex`].
///
/// See [`to_channel_id`].