diff options
| author | zirkonya <zirkonya@iridium.lan> | 2026-08-29 22:11:23 +0200 |
|---|---|---|
| committer | zirkonya <zirkonya@iridium.lan> | 2026-08-29 22:11:23 +0200 |
| commit | bf9b81e669f4ce98c8d58df5d776ae90726d7ec2 (patch) | |
| tree | e0d5bdbd8a3423f1303577ddebbfa34696d336bb /src/transport/connection.rs | |
| parent | bb41e396aca01fee9f81785681fac0a79d0fd9d8 (diff) | |
Add transport layer
Diffstat (limited to 'src/transport/connection.rs')
| -rw-r--r-- | src/transport/connection.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/transport/connection.rs b/src/transport/connection.rs new file mode 100644 index 0000000..34366a2 --- /dev/null +++ b/src/transport/connection.rs @@ -0,0 +1,36 @@ +use std::marker::PhantomData; + +use getset::Getters; + +use crate::transport::{receiver::PacketReceiver, sender::PacketSender}; + +#[derive(Getters)] +pub struct Connection<Uid, Data, S, R> +where + Uid: PartialEq, + S: PacketSender<Data> + Clone, + R: PacketReceiver<Data, Uid>, +{ + #[get = "pub"] + sender: S, + #[get = "pub"] + receiver: R, + _uid: PhantomData<Uid>, + _data: PhantomData<Data>, +} + +impl<Uid, Data, S, R> Connection<Uid, Data, S, R> +where + Uid: PartialEq, + S: PacketSender<Data> + Clone, + R: PacketReceiver<Data, Uid>, +{ + pub fn new(sender: S, receiver: R) -> Self { + Self { + sender, + receiver, + _uid: PhantomData, + _data: PhantomData, + } + } +} |
