polylane 0.13.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)]
		pub use $Trait as $CompatTrait;

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

		#[cfg(not(feature = $feature))]
		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",
		NoUninit      = bytemuck::NoUninit      = "bytemuck",
		Pod           = bytemuck::Pod           = "bytemuck",
		Zeroable      = bytemuck::Zeroable      = "bytemuck",
	}
}

pub mod zerocopy {
	def_compat_traits! {
		FromBytes   = zerocopy::FromBytes   = "zerocopy",
		FromZeros   = zerocopy::FromZeros   = "zerocopy",
		IntoBytes   = zerocopy::IntoBytes   = "zerocopy",
		KnownLayout = zerocopy::KnownLayout = "zerocopy",
	}
}