#![allow(unused_macros, unused_imports)]
macro_rules! impmod {
($($osmod:ident)::+ $(as $into:ident)?) => {
impmod!($($osmod)::+, self $(as $into)?);
};
($($osmod:ident)::+, $($orig:ident $(as $into:ident)?),* $(,)?) => {
#[cfg(unix)]
use $crate::os::unix::$($osmod)::+::{$($orig $(as $into)?,)*};
#[cfg(windows)]
use $crate::os::windows::$($osmod)::+::{$($orig $(as $into)?,)*};
};
}
macro_rules! pinproj_for_unpin {
($src:ty, $dst:ty) => {
impl $src {
#[inline(always)]
fn pinproj(&mut self) -> ::std::pin::Pin<&mut $dst> {
::std::pin::Pin::new(&mut self.0)
}
}
};
}
macro_rules! multimacro {
($pre:tt $ty:ident, $($macro:ident $(($($arg:tt)+))?),+ $(,)?) => {$(
$macro!($pre $ty $(, $($arg)+)?);
)+};
($pre:tt $ty:ty, $($macro:ident $(($($arg:tt)+))?),+ $(,)?) => {$(
$macro!($pre $ty $(, $($arg)+)?);
)+};
($ty:ident, $($macro:ident $(($($arg:tt)+))?),+ $(,)?) => {$(
$macro!($ty $(, $($arg)+)?);
)+};
($ty:ty, $($macro:ident $(($($arg:tt)+))?),+ $(,)?) => {$(
$macro!($ty $(, $($arg)+)?);
)+};
}
macro_rules! forward_rbv {
(@$slf:ident, &) => {
&$slf.0
};
(@$slf:ident, *) => {
&&*$slf.0
};
($ty:ty, $int:ty, $kind:tt) => {
impl $ty {
#[inline(always)]
fn refwd(&self) -> &$int { forward_rbv!(@self, $kind) }
}
};
}
#[rustfmt::skip] macro_rules! builder_must_use {() => {
"builder setters take the entire structure and return it with the corresponding field modified"
};}
macro_rules! builder_setters {
($(#[doc = $($doc:expr)+])+ $name:ident : $ty:ty) => {
$(#[doc = $($doc)+])+
#[must_use = builder_must_use!()]
#[inline(always)]
pub fn $name(mut self, $name: $ty) -> Self {
self.$name = $name.into();
self
}
};
($name:ident : $ty:ty) => {
builder_setters!(
#[doc = concat!(
"Sets the [`",
stringify!($name),
"`](#structfield.", stringify!($name),
") parameter to the specified value."
)]
$name : $ty
);
};
($($(#[doc = $($doc:expr)+])* $name:ident : $ty:ty),+ $(,)?) => {
$(builder_setters!($(#[doc = $($doc)+])* $name: $ty);)+
};
}
macro_rules! tag_enum {
($($(#[$attr:meta])* $tag:ident),+ $(,)?) => {$(
$( #[$attr] )*
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum $tag {}
#[allow(deprecated)]
impl $crate::Sealed for $tag {}
)+};
}
macro_rules! make_macro_modules {
($($modname:ident),+ $(,)?) => {$(
#[macro_use] mod $modname;
pub(crate) use $modname::*;
)+};
}
make_macro_modules! {
derive_raw, derive_mut_iorw, derive_trivconv,
forward_as_ref, forward_fmt, forward_handle_and_fd, forward_iorw, forward_to_self,
forward_try_clone,
}