xelf 0.5.3

A versatile Rust toolkit for self-use.
Documentation
mod duplex;
mod mpsc;
#[cfg(feature = "signal")]
mod signal;
mod sink;

pub use duplex::DuplexStream;
#[cfg(all(feature = "tokio", feature = "tokio-stream", feature = "tokio-util"))]
pub use mpsc::{tokio_mpsc_stream, MpscStream, UnboundedSink};
#[cfg(feature = "signal")]
pub use signal::*;
pub use sink::SinkXlf;

#[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())*
        }
    }
}