kcp-rs 0.2.5

A Rust implementation of KCP Stream Protocol
Documentation
mod duplex;
mod mpsc;

pub use duplex::DuplexStream;
pub use mpsc::{tokio_mpsc_stream, MpscStream, UnboundedSink};

#[cfg(feature = "udp")]
mod udp;
#[cfg(feature = "udp")]
pub use udp::{UdpMpscStream, UdpStream};

#[macro_export]
macro_rules! future_delegate_access_inner {
    ($field:ident, $inner:ty, ($($ind:tt)*)) => {
        /// Acquires a reference to the underlying sink or stream that this combinator is
        /// pulling from.
        #[inline]
        pub fn get_ref(&self) -> &$inner {
            (&self.$field) $($ind get_ref())*
        }

        /// Acquires a mutable reference to the underlying sink or stream that this
        /// combinator is pulling from.
        ///
        /// Note that care must be taken to avoid tampering with the state of the
        /// sink or stream which may otherwise confuse this combinator.
        #[inline]
        pub fn get_mut(&mut self) -> &mut $inner {
            (&mut self.$field) $($ind get_mut())*
        }

        /// Acquires a pinned mutable reference to the underlying sink or stream that this
        /// combinator is pulling from.
        ///
        /// Note that care must be taken to avoid tampering with the state of the
        /// sink or stream which may otherwise confuse this combinator.
        #[inline]
        pub fn get_pin_mut(self: core::pin::Pin<&mut Self>) -> core::pin::Pin<&mut $inner> {
            self.project().$field $($ind get_pin_mut())*
        }

        /// Consumes this combinator, returning the underlying sink or stream.
        ///
        /// Note that this may discard intermediate state of this combinator, so
        /// care should be taken to avoid losing resources when this is called.
        #[inline]
        pub fn into_inner(self) -> $inner {
            self.$field $($ind into_inner())*
        }
    }
}