#[cfg(raw_ref_macros)]
#[macro_export]
#[doc(hidden)]
macro_rules! _memoffset__addr_of {
($path:expr) => {{
$crate::__priv::ptr::addr_of!($path)
}};
}
#[cfg(not(raw_ref_macros))]
#[macro_export]
#[doc(hidden)]
macro_rules! _memoffset__addr_of {
($path:expr) => {{
&$path as *const _
}};
}
#[cfg(allow_clippy)]
#[macro_export]
#[doc(hidden)]
macro_rules! _memoffset__field_check {
($type:path, $field:tt) => {
#[allow(clippy::unneeded_field_pattern)]
let $type { $field: _, .. };
};
}
#[cfg(not(allow_clippy))]
#[macro_export]
#[doc(hidden)]
macro_rules! _memoffset__field_check {
($type:path, $field:tt) => {
let $type { $field: _, .. };
};
}
#[cfg(allow_clippy)]
#[macro_export]
#[doc(hidden)]
macro_rules! _memoffset__field_check_tuple {
($type:ty, $field:tt) => {
#[allow(clippy::unneeded_wildcard_pattern)]
let (_, ..): $type;
};
}
#[cfg(not(allow_clippy))]
#[macro_export]
#[doc(hidden)]
macro_rules! _memoffset__field_check_tuple {
($type:ty, $field:tt) => {
let (_, ..): $type;
};
}
#[cfg(allow_clippy)]
#[macro_export]
#[doc(hidden)]
macro_rules! _memoffset__field_check_union {
($type:path, $field:tt) => {
#[allow(clippy::unneeded_wildcard_pattern)]
#[allow(unused_unsafe)]
unsafe {
let $type { $field: _ };
}
};
}
#[cfg(not(allow_clippy))]
#[macro_export]
#[doc(hidden)]
macro_rules! _memoffset__field_check_union {
($type:path, $field:tt) => {
#[allow(unused_unsafe)]
unsafe {
let $type { $field: _ };
}
};
}
#[macro_export(local_inner_macros)]
macro_rules! raw_field {
($base:expr, $parent:path, $field:tt) => {{
_memoffset__field_check!($parent, $field);
let base = $base;
#[allow(unused_unsafe)] unsafe {
_memoffset__addr_of!((*(base as *const $parent)).$field)
}
}};
}
#[cfg(tuple_ty)]
#[macro_export(local_inner_macros)]
macro_rules! raw_field_tuple {
($base:expr, $parent:ty, $field:tt) => {{
_memoffset__field_check_tuple!($parent, $field);
let base = $base;
#[allow(unused_unsafe)] unsafe {
_memoffset__addr_of!((*(base as *const $parent)).$field)
}
}};
}
#[macro_export(local_inner_macros)]
macro_rules! raw_field_union {
($base:expr, $parent:path, $field:tt) => {{
_memoffset__field_check_union!($parent, $field);
let base = $base;
#[allow(unused_unsafe)] unsafe {
_memoffset__addr_of!((*(base as *const $parent)).$field)
}
}};
}