macro_rules! vec2 {
($($e:expr),*) => { ... };
}Expand description
Macro for creating a 2D vector (Vec2) using a concise syntax.
§Syntax
The vec2! macro accepts a comma-separated list of values, representing the elements of
a 2D vector. It constructs a Vec2 instance using the provided values.
§Examples
let vec = vec2![1.0, 2.0];
assert_eq!(vec.to_arr(), &[1.0, 2.0]);§Notes
- The macro internally uses the
from_arrayfunction to create the vector. - Ensure that the provided expressions are suitable for initializing a 2D vector.
- The resulting
Vec2struct will be created using thefrom_arrayfunction.
§See Also
Vec2: The 2D vector type used by this macro.from_array: Function to construct a vector from an array.