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
//! Messages between a mod's server and client parts.
use c_void;
use crate;
/// A message on a mod's channel, handed to the handler registered with
/// [`HostApi::net_channel`](super::HostApi::net_channel).
///
/// # Examples
///
/// ```
/// use enshwick::abi::{Header, NetMessage};
///
/// let bytes = [1u8, 2, 3];
/// let message = NetMessage {
/// header: Header::of::<NetMessage>(),
/// channel: 0x1234,
/// reserved: 0,
/// peer: NetMessage::SERVER,
/// data: bytes.as_ptr(),
/// size: 3,
/// reserved_tail: 0,
/// };
/// assert_eq!(message.peer, NetMessage::SERVER);
/// ```
impl_headed!;
/// A mod's handler for messages on its channel: the message and the pointer
/// given at registration. It must not unwind.
pub type NetMessageFn = unsafe extern "system" fn;