1#![warn(rust_2018_idioms)]
16#![allow(dead_code)]
17#![allow(clippy::bool_to_int_with_if)]
18
19use bytes::Bytes;
20use std::{fmt, ops};
21
22mod association;
23pub use crate::association::{
24 stats::AssociationStats,
25 stream::{ReliabilityType, Stream, StreamEvent, StreamId, StreamState},
26 timer::TimerConfig,
27 Association, AssociationError, Event,
28};
29
30pub(crate) mod chunk;
31pub use crate::chunk::{
32 chunk_payload_data::{ChunkPayloadData, PayloadProtocolIdentifier},
33 ErrorCauseCode,
34};
35
36mod config;
37pub use crate::config::{ClientConfig, EndpointConfig, ServerConfig, TransportConfig};
38
39mod endpoint;
40pub use crate::endpoint::{AssociationHandle, ConnectError, DatagramEvent, Endpoint};
41
42mod packet;
43
44mod shared;
45pub use crate::shared::{AssociationEvent, AssociationId, EndpointEvent};
46
47pub(crate) mod param;
48
49pub(crate) mod queue;
50pub use crate::queue::reassembly_queue::{Chunk, Chunks};
51
52pub(crate) mod util;
53
54#[derive(Default, Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
56pub enum Side {
57 #[default]
59 Client = 0,
60 Server = 1,
62}
63
64impl fmt::Display for Side {
65 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
66 let s = match *self {
67 Side::Client => "Client",
68 Side::Server => "Server",
69 };
70 write!(f, "{}", s)
71 }
72}
73
74impl Side {
75 #[inline]
76 pub fn is_client(self) -> bool {
78 self == Side::Client
79 }
80
81 #[inline]
82 pub fn is_server(self) -> bool {
84 self == Side::Server
85 }
86}
87
88impl ops::Not for Side {
89 type Output = Side;
90 fn not(self) -> Side {
91 match self {
92 Side::Client => Side::Server,
93 Side::Server => Side::Client,
94 }
95 }
96}
97
98use crate::packet::PartialDecode;
99
100#[derive(Debug)]
102pub enum Payload {
103 PartialDecode(PartialDecode),
104 RawEncode(Vec<Bytes>),
105}