Declare point constructors to be const

Also add const to a vector constructor that I missed before.

Constructors for other types can't yet be const, because the compiler gives an error: "trait bounds other than `Sized` on const fn parameters are unstable".
This commit is contained in:
Nathan Stoddard 2019-01-12 19:59:00 -08:00
parent 9a20f1031c
commit 19f75b88e6
2 changed files with 2 additions and 2 deletions

View file

@ -82,7 +82,7 @@ macro_rules! impl_point {
impl<S> $PointN<S> {
/// Construct a new point, using the provided values.
#[inline]
pub fn new($($field: S),+) -> $PointN<S> {
pub const fn new($($field: S),+) -> $PointN<S> {
$PointN { $($field: $field),+ }
}

View file

@ -358,7 +358,7 @@ macro_rules! impl_vector_default {
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),+ }
}
}