polylane 0.15.0

Portable and versatile SIMD.
Documentation
// Copyright 2025 Gabriel Bjørnager Jensen.
//
// This Source Code Form is subject to the terms of
// the Mozilla Public License, v. 2.0. If a copy of
// the MPL was not distributed with this file, you
// can obtain one at:
// <https://mozilla.org/MPL/2.0/>.

macro_rules! def_compat_traits {
	{ $($CompatTrait:ident = $Trait:ty = $feature:literal),*$(,)? } => {$(
		#[cfg(feature = $feature)]
		#[allow(unused_imports)]
		pub use $Trait as $CompatTrait;

		#[cfg(not(feature = $feature))]
		#[allow(dead_code)]
		pub trait $CompatTrait {}

		#[cfg(not(feature = $feature))]
		#[allow(dead_code)]
		impl<T> $CompatTrait for T {}
	)*};
}

def_compat_traits! {
	Freeze = core::marker::Freeze = "freeze",
	Thin   = core::ptr::Thin      = "thin",
}

pub mod bytemuck {
	def_compat_traits! {
		AnyBitPattern      = bytemuck::AnyBitPattern      = "bytemuck",
		Contiguous         = bytemuck::Contiguous         = "bytemuck",
		NoUninit           = bytemuck::NoUninit           = "bytemuck",
		Pod                = bytemuck::Pod                = "bytemuck",
		PodInOption        = bytemuck::PodInOption        = "bytemuck",
		TransparentWrapper = bytemuck::TransparentWrapper = "bytemuck",
		Zeroable           = bytemuck::Zeroable           = "bytemuck",
		ZeroableInOption   = bytemuck::ZeroableInOption   = "bytemuck",
	}
}

pub mod zerocopy {
	def_compat_traits! {
		FromBytes    = zerocopy::FromBytes    = "zerocopy",
		FromZeros    = zerocopy::FromZeros    = "zerocopy",
		Immutable    = zerocopy::Immutable    = "zerocopy",
		IntoBytes    = zerocopy::IntoBytes    = "zerocopy",
		KnownLayout  = zerocopy::KnownLayout  = "zerocopy",
		SplitAt      = zerocopy::SplitAt      = "zerocopy",
		TryFromBytes = zerocopy::TryFromBytes = "zerocopy",
		Unaligned    = zerocopy::Unaligned    = "zerocopy",
	}
}