Debian Codegraph @

debian/missing-sources/glam-0.16.0/src/vec4.rs

raw symbols SCIP
1 use craterust-analyzer cargo glam 0.16.0 crate/::corerust-analyzer cargo glam 0.16.0 core/::traitsrust-analyzer cargo glam 0.16.0 core/traits/::vectorrust-analyzer cargo glam 0.16.0 core/traits/vector/::*;
2
3 #[cfg(all(target_feature = "sse2", not(feature = "scalar-math")))]
4 use craterust-analyzer cargo glam 0.16.0 crate/::BVec4Arust-analyzer cargo glam 0.16.0 vec_mask/BVec4A#;
5 use craterust-analyzer cargo glam 0.16.0 crate/::{BVec4rust-analyzer cargo glam 0.16.0 vec_mask/BVec4#, DVec2rust-analyzer cargo glam 0.16.0 vec2/DVec2#, DVec3rust-analyzer cargo glam 0.16.0 vec3/DVec3#, IVec2rust-analyzer cargo glam 0.16.0 vec2/IVec2#, IVec3rust-analyzer cargo glam 0.16.0 vec3/IVec3#, UVec2rust-analyzer cargo glam 0.16.0 vec2/UVec2#, UVec3rust-analyzer cargo glam 0.16.0 vec3/UVec3#, Vec2rust-analyzer cargo glam 0.16.0 vec2/Vec2#, Vec3rust-analyzer cargo glam 0.16.0 vec3/Vec3#, Vec3Arust-analyzer cargo glam 0.16.0 vec3/Vec3A#, XYZWrust-analyzer cargo glam 0.16.0 core/storage/XYZW#};
6 #[cfg(not(target_arch = "spirv"))]
7 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/;
8 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::*;
9
10 #[cfg(not(feature = "std"))]
11 use num_traits::Float;
12
13 #[cfg(all(
14 target_arch = "x86",
15 target_feature = "sse2",
16 not(feature = "scalar-math")
17 ))]
18 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::archrust-analyzer cargo core https://github.com/rust-lang/rust/library/core arch/::x86::*;
19 #[cfg(all(
20 target_arch = "x86_64",
21 target_feature = "sse2",
22 not(feature = "scalar-math")
23 ))]
24 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::archrust-analyzer cargo core https://github.com/rust-lang/rust/library/core arch/::x86_64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/arch/x86_64/::*;
25
26 #[cfg(feature = "std")]
27 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::{Productrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/accum/Product#, Sumrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/accum/Sum#};
28
29 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::f32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/;
30
31 macro_rules! impl_vec4_common_methodsrust-analyzer cargo glam 0.16.0 vec4/impl_vec4_common_methods! {
32 ($t:ty, $vec2:ident, $vec3:ident, $vec4:ident, $mask:ident, $inner:ident) => {
33 /// All zeroes.
34 pub const ZERO: Self = Self(VectorConst::ZERO);
35
36 /// All ones.
37 pub const ONE: Self = Self(VectorConst::ONE);
38
39 /// `[1, 0, 0, 0]`: a unit-length vector pointing along the positive X axis.
40 pub const X: Self = Self(Vector4Const::X);
41
42 /// `[0, 1, 0, 0]`: a unit-length vector pointing along the positive Y axis.
43 pub const Y: Self = Self(Vector4Const::Y);
44
45 /// `[0, 0, 1, 0]`: a unit-length vector pointing along the positive Z axis.
46 pub const Z: Self = Self(Vector4Const::Z);
47
48 /// `[0, 0, 0, 1]`: a unit-length vector pointing along the positive W axis.
49 pub const W: Self = Self(Vector4Const::W);
50
51 /// The unit axes.
52 pub const AXES: [Self; 4] = [Self::X, Self::Y, Self::Z, Self::W];
53
54 /// Creates a new 4D vector.
55 #[inline(always)]
56 pub fn new(x: $t, y: $t, z: $t, w: $t) -> Self {
57 Self(Vector4::new(x, y, z, w))
58 }
59
60 /// Creates a `Vec3` from the `x`, `y` and `z` elements of `self`, discarding `w`.
61 ///
62 /// Truncation to `Vec3` may also be performed by using `self.xyz()` or `Vec3::from()`.
63 ///
64 /// To truncate to `Vec3A` use `Vec3A::from()`.
65 #[inline(always)]
66 pub fn truncate(self) -> $vec3 {
67 $vec3::new(self.x, self.y, self.z)
68 }
69
70 /// `[x, y, z, w]`
71 #[inline(always)]
72 pub fn to_array(&self) -> [$t; 4] {
73 [self.x, self.y, self.z, self.w]
74 }
75
76 impl_vecn_common_methods!($t, $vec4, $mask, $inner, Vector4);
77 };
78 }
79
80 macro_rules! impl_vec4_common_traitsrust-analyzer cargo glam 0.16.0 vec4/impl_vec4_common_traits! {
81 ($t:ty, $new:ident, $vec2:ident, $vec3:ident, $vec4:ident, $mask:ident, $inner:ident) => {
82 /// Creates a 4-dimensional vector.
83 #[inline(always)]
84 pub fn $new(x: $t, y: $t, z: $t, w: $t) -> $vec4 {
85 $vec4::new(x, y, z, w)
86 }
87
88 #[cfg(not(target_arch = "spirv"))]
89 impl fmt::Debug for $vec4 {
90 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
91 fmt.debug_tuple(stringify!($vec4))
92 .field(&self.x)
93 .field(&self.y)
94 .field(&self.z)
95 .field(&self.w)
96 .finish()
97 }
98 }
99
100 #[cfg(not(target_arch = "spirv"))]
101 impl fmt::Display for $vec4 {
102 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
103 write!(fmt, "[{}, {}, {}, {}]", self.x, self.y, self.z, self.w)
104 }
105 }
106
107 impl From<($t, $t, $t, $t)> for $vec4 {
108 #[inline(always)]
109 fn from(t: ($t, $t, $t, $t)) -> Self {
110 Self(Vector4::from_tuple(t))
111 }
112 }
113
114 impl From<$vec4> for ($t, $t, $t, $t) {
115 #[inline(always)]
116 fn from(v: $vec4) -> Self {
117 Vector4::into_tuple(v.0)
118 }
119 }
120
121 impl From<($vec3, $t)> for $vec4 {
122 #[inline(always)]
123 fn from((v, w): ($vec3, $t)) -> Self {
124 Self::new(v.x, v.y, v.z, w)
125 }
126 }
127
128 impl From<($vec2, $t, $t)> for $vec4 {
129 #[inline(always)]
130 fn from((v, z, w): ($vec2, $t, $t)) -> Self {
131 Self::new(v.x, v.y, z, w)
132 }
133 }
134
135 impl From<($vec2, $vec2)> for $vec4 {
136 #[inline(always)]
137 fn from((v, u): ($vec2, $vec2)) -> Self {
138 Self::new(v.x, v.y, u.x, u.y)
139 }
140 }
141
142 impl From<$vec4> for $vec3 {
143 /// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`.
144 #[inline(always)]
145 fn from(v: $vec4) -> Self {
146 Self(v.into_xyz())
147 }
148 }
149
150 impl From<$vec4> for $vec2 {
151 /// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z` and
152 /// `w`.
153 #[inline(always)]
154 fn from(v: $vec4) -> Self {
155 Self(v.into_xy())
156 }
157 }
158
159 impl Deref for $vec4 {
160 type Target = XYZW<$t>;
161 #[inline(always)]
162 fn deref(&self) -> &Self::Target {
163 self.0.as_ref_xyzw()
164 }
165 }
166
167 impl DerefMut for $vec4 {
168 #[inline(always)]
169 fn deref_mut(&mut self) -> &mut Self::Target {
170 self.0.as_mut_xyzw()
171 }
172 }
173
174 impl_vecn_common_traits!($t, 4, $vec4, $inner, Vector4);
175 };
176 }
177
178 macro_rules! impl_vec4_signed_methodsrust-analyzer cargo glam 0.16.0 vec4/impl_vec4_signed_methods! {
179 ($t:ty, $vec2:ident, $vec3:ident, $vec4:ident, $mask:ident, $inner:ident) => {
180 impl_vec4_common_methods!($t, $vec2, $vec3, $vec4, $mask, $inner);
181 impl_vecn_signed_methods!($t, $vec4, $mask, $inner, SignedVector4);
182 };
183 }
184
185 macro_rules! impl_vec4_signed_traitsrust-analyzer cargo glam 0.16.0 vec4/impl_vec4_signed_traits! {
186 ($t:ty, $new:ident, $vec2:ident, $vec3:ident, $vec4:ident, $mask:ident, $inner:ident) => {
187 impl_vec4_common_traits!($t, $new, $vec2, $vec3, $vec4, $mask, $inner);
188 impl_vecn_signed_traits!($t, 4, $vec4, $inner, SignedVector4);
189 };
190 }
191
192 macro_rules! impl_vec4_float_methodsrust-analyzer cargo glam 0.16.0 vec4/impl_vec4_float_methods! {
193 ($t:ty, $vec2:ident, $vec3:ident, $vec4:ident, $mask:ident, $inner:ident) => {
194 impl_vec4_signed_methods!($t, $vec2, $vec3, $vec4, $mask, $inner);
195 impl_vecn_float_methods!($t, $vec4, $mask, $inner, FloatVector4);
196 };
197 }
198
199 // implement `Vec4` functionality
200 macro_rules! impl_f32_vec4rust-analyzer cargo glam 0.16.0 vec4/impl_f32_vec4! {
201 ($new:ident, $vec2:ident, $vec3:ident, $vec4:ident, $mask:ident, $inner:ident) => {
202 impl $vec4 {
203 impl_vec4_float_methods!(f32, $vec2, $vec3, $vec4, $mask, $inner);
204 impl_vecn_as_f64!(DVec4, x, y, z, w);
205 impl_vecn_as_i32!(IVec4, x, y, z, w);
206 impl_vecn_as_u32!(UVec4, x, y, z, w);
207 }
208 impl_vec4_signed_traits!(f32, $new, $vec2, $vec3, $vec4, $mask, $inner);
209 };
210 }
211
212 #[cfg(any(not(target_feature = "sse2"), feature = "scalar-math"))]
213 type XYZWF32 = XYZWrust-analyzer cargo glam 0.16.0 core/storage/XYZW#<f32>;
214
215 #[cfg(all(target_feature = "sse2", not(feature = "scalar-math")))]
216 type XYZWF32rust-analyzer cargo glam 0.16.0 vec4/XYZWF32# = __m128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m128#;
217
218 /// A 4-dimensional vector.
219 ///
220 /// This type uses 16 byte aligned SIMD vector type for storage on supported platforms.
221 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:)]
222 #[cfg_attr(
223 not(any(feature = "scalar-math", target_arch = "spriv")),
224 repr(align(16))
225 )]
226 #[cfg_attr(any(feature = "scalar-math", target_arch = "spriv"), repr(transparent))]
227 pub struct Vec4rust-analyzer cargo glam 0.16.0 vec4/Vec4#(pub(craterust-analyzer cargo glam 0.16.0 crate/) XYZWF32rust-analyzer cargo glam 0.16.0 vec4/XYZWF32#);
228
229 #[cfg(any(not(target_feature = "sse2"), feature = "scalar-math"))]
230 impl_f32_vec4rust-analyzer cargo glam 0.16.0 vec4/impl_f32_vec4!!(vec4, Vec2, Vec3, Vec4, BVec4, XYZWF32);
231
232 #[cfg(all(target_feature = "sse2", not(feature = "scalar-math")))]
233 impl_f32_vec4rust-analyzer cargo glam 0.16.0 vec4/impl_f32_vec4!!(vec4rust-analyzer cargo glam 0.16.0 vec4/vec4()., Vec2rust-analyzer cargo glam 0.16.0 vec2/Vec2#, Vec3rust-analyzer cargo glam 0.16.0 vec3/Vec3#, Vec4rust-analyzer cargo glam 0.16.0 vec4/Vec4#, BVec4Arust-analyzer cargo glam 0.16.0 vec_mask/BVec4A#, __m128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m128#);
234
235 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Vec4rust-analyzer cargo glam 0.16.0 vec4/Vec4#> for Vec3Arust-analyzer cargo glam 0.16.0 vec3/Vec3A# {
236 /// Creates a `Vec3A` from the `x`, `y` and `z` elements of `self` discarding `w`.
237 ///
238 /// On architectures where SIMD is supported such as SSE2 on x86_64 this conversion is a noop.
239 #[inline(always)]
240 fn fromrust-analyzer cargo glam 0.16.0 vec4/impl#[Vec3A][`From<Vec4>`]from().(v: Vec4rust-analyzer cargo glam 0.16.0 vec4/Vec4#) -> Selfrust-analyzer cargo glam 0.16.0 vec4/impl#[Vec3A][`From<Vec4>`] {
241 #[allow(clippy::useless_conversion)]
242 Selfrust-analyzer cargo glam 0.16.0 vec4/impl#[Vec3A][`From<Vec4>`](v.0rust-analyzer cargo glam 0.16.0 vec4/Vec4#0..intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())
243 }
244 }
245
246 type XYZWF64rust-analyzer cargo glam 0.16.0 vec4/XYZWF64# = XYZWrust-analyzer cargo glam 0.16.0 core/storage/XYZW#<f64>;
247
248 /// A 4-dimensional vector.
249 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:)]
250 #[repr(transparent)]
251 pub struct DVec4rust-analyzer cargo glam 0.16.0 vec4/DVec4#(pub(craterust-analyzer cargo glam 0.16.0 crate/) XYZWF64rust-analyzer cargo glam 0.16.0 vec4/XYZWF64#);
252
253 impl DVec4rust-analyzer cargo glam 0.16.0 vec4/DVec4# {
254 impl_vec4_float_methodsrust-analyzer cargo glam 0.16.0 vec4/impl_vec4_float_methods!!(f64, DVec2, DVec3rust-analyzer cargo glam 0.16.0 vec3/DVec3#, DVec4rust-analyzer cargo glam 0.16.0 vec4/DVec4#, BVec4rust-analyzer cargo glam 0.16.0 vec_mask/BVec4#, XYZWF64rust-analyzer cargo glam 0.16.0 vec4/XYZWF64#);
255 impl_vecn_as_f32rust-analyzer cargo glam 0.16.0 vec/impl_vecn_as_f32!!(Vec4rust-analyzer cargo glam 0.16.0 vec4/Vec4#, xrust-analyzer cargo glam 0.16.0 core/storage/XYZW#x., yrust-analyzer cargo glam 0.16.0 core/storage/XYZW#y., zrust-analyzer cargo glam 0.16.0 core/storage/XYZW#z., wrust-analyzer cargo glam 0.16.0 core/storage/XYZW#w.);
256 impl_vecn_as_i32rust-analyzer cargo glam 0.16.0 vec/impl_vecn_as_i32!!(IVec4rust-analyzer cargo glam 0.16.0 vec4/IVec4#, xrust-analyzer cargo glam 0.16.0 core/storage/XYZW#x., yrust-analyzer cargo glam 0.16.0 core/storage/XYZW#y., zrust-analyzer cargo glam 0.16.0 core/storage/XYZW#z., wrust-analyzer cargo glam 0.16.0 core/storage/XYZW#w.);
257 impl_vecn_as_u32rust-analyzer cargo glam 0.16.0 vec/impl_vecn_as_u32!!(UVec4rust-analyzer cargo glam 0.16.0 vec4/UVec4#, xrust-analyzer cargo glam 0.16.0 core/storage/XYZW#x., yrust-analyzer cargo glam 0.16.0 core/storage/XYZW#y., zrust-analyzer cargo glam 0.16.0 core/storage/XYZW#z., wrust-analyzer cargo glam 0.16.0 core/storage/XYZW#w.);
258 }
259 impl_vec4_signed_traitsrust-analyzer cargo glam 0.16.0 vec4/impl_vec4_signed_traits!!(f64, dvec4rust-analyzer cargo glam 0.16.0 vec4/dvec4()., DVec2rust-analyzer cargo glam 0.16.0 vec2/DVec2#, DVec3rust-analyzer cargo glam 0.16.0 vec3/DVec3#, DVec4rust-analyzer cargo glam 0.16.0 vec4/DVec4#, BVec4, XYZWF64rust-analyzer cargo glam 0.16.0 vec4/XYZWF64#);
260
261 type XYZWI32rust-analyzer cargo glam 0.16.0 vec4/XYZWI32# = XYZWrust-analyzer cargo glam 0.16.0 core/storage/XYZW#<i32>;
262
263 /// A 4-dimensional vector.
264 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:)]
265 #[repr(transparent)]
266 pub struct IVec4rust-analyzer cargo glam 0.16.0 vec4/IVec4#(pub(craterust-analyzer cargo glam 0.16.0 crate/) XYZWI32rust-analyzer cargo glam 0.16.0 vec4/XYZWI32#);
267
268 impl IVec4rust-analyzer cargo glam 0.16.0 vec4/IVec4# {
269 impl_vec4_signed_methodsrust-analyzer cargo glam 0.16.0 vec4/impl_vec4_signed_methods!!(i32, IVec2, IVec3rust-analyzer cargo glam 0.16.0 vec3/IVec3#, IVec4rust-analyzer cargo glam 0.16.0 vec4/IVec4#, BVec4rust-analyzer cargo glam 0.16.0 vec_mask/BVec4#, XYZWI32rust-analyzer cargo glam 0.16.0 vec4/XYZWI32#);
270 impl_vecn_as_f32rust-analyzer cargo glam 0.16.0 vec/impl_vecn_as_f32!!(Vec4rust-analyzer cargo glam 0.16.0 vec4/Vec4#, xrust-analyzer cargo glam 0.16.0 core/storage/XYZW#x., yrust-analyzer cargo glam 0.16.0 core/storage/XYZW#y., zrust-analyzer cargo glam 0.16.0 core/storage/XYZW#z., wrust-analyzer cargo glam 0.16.0 core/storage/XYZW#w.);
271 impl_vecn_as_f64rust-analyzer cargo glam 0.16.0 vec/impl_vecn_as_f64!!(DVec4rust-analyzer cargo glam 0.16.0 vec4/DVec4#, xrust-analyzer cargo glam 0.16.0 core/storage/XYZW#x., yrust-analyzer cargo glam 0.16.0 core/storage/XYZW#y., zrust-analyzer cargo glam 0.16.0 core/storage/XYZW#z., wrust-analyzer cargo glam 0.16.0 core/storage/XYZW#w.);
272 impl_vecn_as_u32rust-analyzer cargo glam 0.16.0 vec/impl_vecn_as_u32!!(UVec4rust-analyzer cargo glam 0.16.0 vec4/UVec4#, xrust-analyzer cargo glam 0.16.0 core/storage/XYZW#x., yrust-analyzer cargo glam 0.16.0 core/storage/XYZW#y., zrust-analyzer cargo glam 0.16.0 core/storage/XYZW#z., wrust-analyzer cargo glam 0.16.0 core/storage/XYZW#w.);
273 }
274 impl_vec4_signed_traitsrust-analyzer cargo glam 0.16.0 vec4/impl_vec4_signed_traits!!(i32, ivec4rust-analyzer cargo glam 0.16.0 vec4/ivec4()., IVec2rust-analyzer cargo glam 0.16.0 vec2/IVec2#, IVec3rust-analyzer cargo glam 0.16.0 vec3/IVec3#, IVec4rust-analyzer cargo glam 0.16.0 vec4/IVec4#, BVec4, XYZWI32rust-analyzer cargo glam 0.16.0 vec4/XYZWI32#);
275 impl_vecn_eq_hash_traitsrust-analyzer cargo glam 0.16.0 vec/impl_vecn_eq_hash_traits!!(i32, 4, IVec4rust-analyzer cargo glam 0.16.0 vec4/IVec4#);
276
277 type XYZWU32rust-analyzer cargo glam 0.16.0 vec4/XYZWU32# = XYZWrust-analyzer cargo glam 0.16.0 core/storage/XYZW#<u32>;
278
279 /// A 4-dimensional vector.
280 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:)]
281 #[repr(transparent)]
282 pub struct UVec4rust-analyzer cargo glam 0.16.0 vec4/UVec4#(pub(craterust-analyzer cargo glam 0.16.0 crate/) XYZWU32rust-analyzer cargo glam 0.16.0 vec4/XYZWU32#);
283
284 impl UVec4rust-analyzer cargo glam 0.16.0 vec4/UVec4# {
285 impl_vec4_common_methodsrust-analyzer cargo glam 0.16.0 vec4/impl_vec4_common_methods!!(u32, UVec2, UVec3rust-analyzer cargo glam 0.16.0 vec3/UVec3#, UVec4rust-analyzer cargo glam 0.16.0 vec4/UVec4#, BVec4rust-analyzer cargo glam 0.16.0 vec_mask/BVec4#, XYZWU32rust-analyzer cargo glam 0.16.0 vec4/XYZWU32#);
286 impl_vecn_as_f32rust-analyzer cargo glam 0.16.0 vec/impl_vecn_as_f32!!(Vec4rust-analyzer cargo glam 0.16.0 vec4/Vec4#, xrust-analyzer cargo glam 0.16.0 core/storage/XYZW#x., yrust-analyzer cargo glam 0.16.0 core/storage/XYZW#y., zrust-analyzer cargo glam 0.16.0 core/storage/XYZW#z., wrust-analyzer cargo glam 0.16.0 core/storage/XYZW#w.);
287 impl_vecn_as_f64rust-analyzer cargo glam 0.16.0 vec/impl_vecn_as_f64!!(DVec4rust-analyzer cargo glam 0.16.0 vec4/DVec4#, xrust-analyzer cargo glam 0.16.0 core/storage/XYZW#x., yrust-analyzer cargo glam 0.16.0 core/storage/XYZW#y., zrust-analyzer cargo glam 0.16.0 core/storage/XYZW#z., wrust-analyzer cargo glam 0.16.0 core/storage/XYZW#w.);
288 impl_vecn_as_i32rust-analyzer cargo glam 0.16.0 vec/impl_vecn_as_i32!!(IVec4rust-analyzer cargo glam 0.16.0 vec4/IVec4#, xrust-analyzer cargo glam 0.16.0 core/storage/XYZW#x., yrust-analyzer cargo glam 0.16.0 core/storage/XYZW#y., zrust-analyzer cargo glam 0.16.0 core/storage/XYZW#z., wrust-analyzer cargo glam 0.16.0 core/storage/XYZW#w.);
289 }
290 impl_vec4_common_traitsrust-analyzer cargo glam 0.16.0 vec4/impl_vec4_common_traits!!(u32, uvec4rust-analyzer cargo glam 0.16.0 vec4/uvec4()., UVec2rust-analyzer cargo glam 0.16.0 vec2/UVec2#, UVec3rust-analyzer cargo glam 0.16.0 vec3/UVec3#, UVec4rust-analyzer cargo glam 0.16.0 vec4/UVec4#, BVec4, XYZWU32rust-analyzer cargo glam 0.16.0 vec4/XYZWU32#);
291 impl_vecn_eq_hash_traitsrust-analyzer cargo glam 0.16.0 vec/impl_vecn_eq_hash_traits!!(u32, 4, UVec4rust-analyzer cargo glam 0.16.0 vec4/UVec4#);
292
293 #[test]
294 fn test_vec4_private() {
295 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
296 vec4(1.0, 1.0, 1.0, 1.0).mul_add(vec4(0.5, 2.0, -4.0, 0.0), vec4(-1.0, -1.0, -1.0, -1.0)),
297 vec4(-0.5, 1.0, -5.0, -1.0)
298 );
299 }
300
301 #[cfg(test)]
302 mod tests {
303 use superrust-analyzer cargo glam 0.16.0 crate/::{vec4rust-analyzer cargo glam 0.16.0 vec4/, Vec3rust-analyzer cargo glam 0.16.0 vec3/Vec3#};
304
305 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
306 fn from_vec3() {
307 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
308 vec4(1.0, 2.0, 3.0, 4.0),
309 (Vec3::new(1.0, 2.0, 3.0), 4.0).into()
310 );
311 }
312 }
313
314 #[cfg(any(feature = "scalar-math", target_arch = "spriv"))]
315 mod const_test_vec4rust-analyzer cargo glam 0.16.0 vec4/const_test_vec4/ {
316 const_assert_eqrust-analyzer cargo glam 0.16.0 macros/const_assert_eq!!(4, core::mem::align_of::<super::Vec4>());
317 const_assert_eqrust-analyzer cargo glam 0.16.0 macros/const_assert_eq!!(16, core::mem::size_of::<super::Vec4>());
318 }
319
320 #[cfg(not(any(feature = "scalar-math", target_arch = "spriv")))]
321 mod const_test_vec4rust-analyzer cargo glam 0.16.0 vec4/const_test_vec4/ {
322 const_assert_eqrust-analyzer cargo glam 0.16.0 macros/const_assert_eq!!(16, corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::align_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/align_of().::<superrust-analyzer cargo glam 0.16.0 vec4/::Vec4rust-analyzer cargo glam 0.16.0 vec4/Vec4#>());
323 const_assert_eqrust-analyzer cargo glam 0.16.0 macros/const_assert_eq!!(16, corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<superrust-analyzer cargo glam 0.16.0 vec4/::Vec4rust-analyzer cargo glam 0.16.0 vec4/Vec4#>());
324 }
325
326 mod const_test_dvec4rust-analyzer cargo glam 0.16.0 vec4/const_test_dvec4/ {
327 const_assert_eqrust-analyzer cargo glam 0.16.0 macros/const_assert_eq!!(8, corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::align_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/align_of().::<superrust-analyzer cargo glam 0.16.0 vec4/::DVec4rust-analyzer cargo glam 0.16.0 vec4/DVec4#>());
328 const_assert_eqrust-analyzer cargo glam 0.16.0 macros/const_assert_eq!!(32, corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<superrust-analyzer cargo glam 0.16.0 vec4/::DVec4rust-analyzer cargo glam 0.16.0 vec4/DVec4#>());
329 }
330
331 mod const_test_ivec4rust-analyzer cargo glam 0.16.0 vec4/const_test_ivec4/ {
332 const_assert_eqrust-analyzer cargo glam 0.16.0 macros/const_assert_eq!!(4, corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::align_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/align_of().::<superrust-analyzer cargo glam 0.16.0 vec4/::IVec4rust-analyzer cargo glam 0.16.0 vec4/IVec4#>());
333 const_assert_eqrust-analyzer cargo glam 0.16.0 macros/const_assert_eq!!(16, corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<superrust-analyzer cargo glam 0.16.0 vec4/::IVec4rust-analyzer cargo glam 0.16.0 vec4/IVec4#>());
334 }
335
336 mod const_test_uvec4rust-analyzer cargo glam 0.16.0 vec4/const_test_uvec4/ {
337 const_assert_eqrust-analyzer cargo glam 0.16.0 macros/const_assert_eq!!(4, corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::align_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/align_of().::<superrust-analyzer cargo glam 0.16.0 vec4/::UVec4rust-analyzer cargo glam 0.16.0 vec4/UVec4#>());
338 const_assert_eqrust-analyzer cargo glam 0.16.0 macros/const_assert_eq!!(16, corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<superrust-analyzer cargo glam 0.16.0 vec4/::UVec4rust-analyzer cargo glam 0.16.0 vec4/UVec4#>());
339 }