Declare vector constructors to be const

This makes it easier to create vectors in constants.
This commit is contained in:
Nathan Stoddard 2019-01-12 14:50:34 -08:00
parent 5e758d13bd
commit 9a20f1031c

View file

@ -99,7 +99,7 @@ macro_rules! impl_vector {
impl<S> $VectorN<S> {
/// Construct a new vector, using the provided values.
#[inline]
pub fn new($($field: S),+) -> $VectorN<S> {
pub const fn new($($field: S),+) -> $VectorN<S> {
$VectorN { $($field: $field),+ }
}
@ -115,7 +115,7 @@ macro_rules! impl_vector {
/// The short constructor.
#[inline]
pub fn $constructor<S>($($field: S),+) -> $VectorN<S> {
pub const fn $constructor<S>($($field: S),+) -> $VectorN<S> {
$VectorN::new($($field),+)
}