@@ -19,32 +19,31 @@ pub unsafe trait ScalarOrVector: ScalarComposite + Default {
1919 const N : NonZeroUsize ;
2020}
2121
22- /// A `VectorOrScalarComposite ` is a type that is either
22+ /// A `ScalarComposite ` is a type that is either
2323/// * a [`Scalar`]
24- /// * a [`Vector`]
25- /// * an array of `VectorOrScalarComposite `
26- /// * a struct where all members are `VectorOrScalarComposite `
24+ /// * a [`Vector`] (since vectors are made from scalars)
25+ /// * an array of `ScalarComposite `
26+ /// * a struct where all members are `ScalarComposite `
2727/// * an enum with a `repr` that is a [`Scalar`]
2828///
2929/// By calling [`Self::transform`] you can visit all the individual [`Scalar`] and [`Vector`] values this composite is
3030/// build out of and transform them into some other value. This is particularly useful for subgroup intrinsics sending
3131/// data to other threads.
3232///
33- /// To derive `#[derive(VectorOrScalarComposite)]` on a struct, all members must also implement
34- /// `VectorOrScalarComposite`.
33+ /// To derive `ScalarComposite` on a struct, all members must also implement `ScalarComposite`.
3534///
36- /// To derive it on an enum, the enum must implement `From<N>` and `Into<N>` where `N` is defined by the `#[repr(N)]`
37- /// attribute on the enum and is an [`Integer`], like `u32`.
35+ /// To derive `ScalarComposite` on an enum, the enum must implement `From<N>` and `Into<N>` where `N` is defined by the
36+ /// `#[repr(N)]` attribute on the enum and must be an [`Integer`], like `u32`.
3837/// Note that some [safe subgroup operations] may return an "undefined result", so your `From<N>` must gracefully handle
3938/// arbitrary bit patterns being passed to it. While panicking is legal, it is discouraged as it may result in
4039/// unexpected control flow.
4140/// To implement these conversion traits, we recommend [`FromPrimitive`] and [`IntoPrimitive`] from the [`num_enum`]
42- /// crate. [`FromPrimitive`] requires that either the enum is exhaustive, or you provide it with a variant to default
43- /// to, by either implementing [`Default`] or marking a variant with `#[num_enum(default)]`. Note to disable default
41+ /// crate. [`FromPrimitive`] requires the enum to either be exhaustive or have a variant to default to, by either
42+ /// implementing [`Default`] or marking a variant with `#[num_enum(default)]`. Note to disable default
4443/// features on the [`num_enum`] crate, or it won't compile on SPIR-V.
4544///
4645/// [`Integer`]: crate::Integer
47- /// [subgroup operations]: crate::arch::subgroup_shuffle
46+ /// [safe subgroup operations]: crate::arch::subgroup_shuffle
4847/// [`FromPrimitive`]: https://docs.rs/num_enum/latest/num_enum/derive.FromPrimitive.html
4948/// [`IntoPrimitive`]: https://docs.rs/num_enum/latest/num_enum/derive.IntoPrimitive.html
5049/// [`num_enum`]: https://crates.io/crates/num_enum
@@ -60,13 +59,13 @@ pub trait ScalarOrVectorTransform {
6059 /// transform a [`ScalarOrVector`]
6160 fn transform < T : ScalarOrVector > ( & mut self , value : T ) -> T ;
6261
63- /// transform a [`Scalar`], defaults to [`self. transform`]
62+ /// transform a [`Scalar`], defaults to [`Self:: transform`]
6463 #[ inline]
6564 fn transform_scalar < T : Scalar > ( & mut self , value : T ) -> T {
6665 self . transform ( value)
6766 }
6867
69- /// transform a [`Vector`], defaults to [`self. transform`]
68+ /// transform a [`Vector`], defaults to [`Self:: transform`]
7069 #[ inline]
7170 fn transform_vector < V : Vector < S , N > , S : Scalar , const N : usize > ( & mut self , value : V ) -> V {
7271 self . transform ( value)
0 commit comments