aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 0000000..615806a
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,30 @@
+use serde::{Deserialize, Serialize};
+
+pub const DEFAULT_MESSAGE_QUEUE_SIZE: usize = 150;
+pub const DEFAULT_KILL_MESSAGE_QUEUE_SIZE: usize = 10;
+pub const DEFAULT_KEEP_ALIVE_INTERVAL_S: u64 = 4;
+
+pub mod client;
+pub mod server;
+
+pub type ClientId = u64;
+
+/// Enum with possibles errors that can occur.
+#[derive(Debug)]
+pub enum QuinnetError {
+ /// Failed serialization
+ Serialization,
+ /// Failed deserialization
+ Deserialization,
+ /// The data could not be sent on the channel because the channel is
+ /// currently full and sending would require blocking.
+ FullQueue,
+ /// The receive half of the channel was explicitly closed or has been
+ /// dropped.
+ ChannelClosed,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+enum ServerMessage {
+ AssignId { client_id: ClientId },
+}