#![cfg(any(test, doc))]
#![cfg_attr(feature = "unstable", doc(cfg(test)))]
pub(crate) fn eq_slice_buf<T>(a: &[T], b: &[T]) -> bool {
a.as_ptr() == b.as_ptr() && a.len() == b.len()
}
#[doc(alias = "assert_fits_in")]
macro_rules! assert_fits_in_impl {
($expr: expr, $ty: ty) => {
assert!(<$ty>::try_from($expr).is_ok(), "{} does not fit into {}", stringify!($expr), stringify!($ty))
};
($expr: expr, $ty: ty, $($arg: tt)+) => {
assert!(<$ty>::try_from($expr).is_ok(), $($arg)+)
};
}
pub(crate) use assert_fits_in_impl as assert_fits_in;
#[doc(alias = "test_for_each_type")]
macro_rules! test_for_each_type_impl {
($id: path, [$($($ty: ty),+ $(,)?)?]) => {
$($(
loop {
$id!($ty);
break;
}
)+)?
};
}
pub(crate) use test_for_each_type_impl as test_for_each_type;
#[doc(alias = "test_recommended_default")]
macro_rules! test_recommended_default_impl {
($ty: ty) => {{
let value1 = <$ty>::new();
let value2 = <$ty>::default();
assert_eq!(value1, value2);
}};
}
pub(crate) use test_recommended_default_impl as test_recommended_default;
mod tests;