hanabi_core/protocol/status.rs
1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
4#[repr(u32)]
5pub enum Status {
6 /// Sent when an operation succeeds.
7 Ok = 1000,
8
9 /// Sent when an operation fails with an unknown error.
10 Unknown = 1001,
11
12 /// Sent when reading from a data stream and the amount of data received
13 /// was below the expected amount.
14 IncompleteDataStream = 2000,
15
16 /// Sent when the operation the remote peer tried to execute is not
17 /// within the current capabilities of the server.
18 UnsupportedOperation = 2001,
19
20 /// Sent when the data read failed deserialization into the expected object.
21 UnexpectedDataFormat = 2002,
22
23 /// The peer failed to send data back.
24 WriteFailed = 2003,
25
26 /// Reading from the data stream failed.
27 ReadFailed = 2004,
28
29 /// Sent when the client requested the Control executor to open a stream,
30 /// but the server could not complete the request.
31 StreamNotOpen = 3000,
32
33 /// Sent when the peer timed out waiting for the remote peer to open
34 /// either accept or open a stream.
35 StreamOpenTimeout = 3001,
36
37 /// An internal messaging channel has been closed indicating that the QUIC stream
38 /// should also be closed.
39 ChannelClosed = 3002,
40
41 /// Sent when a key is not present in the key-value data store.
42 KeyNotPresent = 4000,
43}
44
45impl Status {
46 pub fn into_u32(self) -> u32 {
47 self as u32
48 }
49}