spirv_std/
scalar_or_vector.rs

1use crate::Scalar;
2use core::num::NonZeroUsize;
3
4pub(crate) mod sealed {
5    /// A marker trait used to prevent other traits from being implemented outside
6    /// of `spirv-std`.
7    pub trait Sealed {}
8}
9
10/// Abstract trait representing either a [`Scalar`] or [`Vector`] type.
11///
12/// # Safety
13/// Your type must also implement [`Scalar`] or [`Vector`], see their safety sections as well.
14///
15/// [`Vector`]: crate::Vector
16pub unsafe trait ScalarOrVector: Copy + Default + Send + Sync + 'static {
17    /// Either the scalar component type of the vector or the scalar itself.
18    type Scalar: Scalar;
19
20    /// The dimension of the vector, or 1 if it is a scalar
21    const N: NonZeroUsize;
22}