kcp/transport/
mod.rs

1mod duplex;
2mod mpsc;
3
4pub use duplex::DuplexStream;
5pub use mpsc::{tokio_mpsc_stream, MpscStream, UnboundedSink};
6
7#[cfg(feature = "udp")]
8mod udp;
9#[cfg(feature = "udp")]
10pub use udp::{UdpMpscStream, UdpStream};
11
12#[macro_export]
13macro_rules! future_delegate_access_inner {
14    ($field:ident, $inner:ty, ($($ind:tt)*)) => {
15        /// Acquires a reference to the underlying sink or stream that this combinator is
16        /// pulling from.
17        #[inline]
18        pub fn get_ref(&self) -> &$inner {
19            (&self.$field) $($ind get_ref())*
20        }
21
22        /// Acquires a mutable reference to the underlying sink or stream that this
23        /// combinator is pulling from.
24        ///
25        /// Note that care must be taken to avoid tampering with the state of the
26        /// sink or stream which may otherwise confuse this combinator.
27        #[inline]
28        pub fn get_mut(&mut self) -> &mut $inner {
29            (&mut self.$field) $($ind get_mut())*
30        }
31
32        /// Acquires a pinned mutable reference to the underlying sink or stream that this
33        /// combinator is pulling from.
34        ///
35        /// Note that care must be taken to avoid tampering with the state of the
36        /// sink or stream which may otherwise confuse this combinator.
37        #[inline]
38        pub fn get_pin_mut(self: core::pin::Pin<&mut Self>) -> core::pin::Pin<&mut $inner> {
39            self.project().$field $($ind get_pin_mut())*
40        }
41
42        /// Consumes this combinator, returning the underlying sink or stream.
43        ///
44        /// Note that this may discard intermediate state of this combinator, so
45        /// care should be taken to avoid losing resources when this is called.
46        #[inline]
47        pub fn into_inner(self) -> $inner {
48            self.$field $($ind into_inner())*
49        }
50    }
51}