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:
parent
9a20f1031c
commit
19f75b88e6
2 changed files with 2 additions and 2 deletions
|
@ -82,7 +82,7 @@ macro_rules! impl_point {
|
||||||
impl<S> $PointN<S> {
|
impl<S> $PointN<S> {
|
||||||
/// Construct a new point, using the provided values.
|
/// Construct a new point, using the provided values.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new($($field: S),+) -> $PointN<S> {
|
pub const fn new($($field: S),+) -> $PointN<S> {
|
||||||
$PointN { $($field: $field),+ }
|
$PointN { $($field: $field),+ }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -358,7 +358,7 @@ macro_rules! impl_vector_default {
|
||||||
impl<S> $VectorN<S> {
|
impl<S> $VectorN<S> {
|
||||||
/// Construct a new vector, using the provided values.
|
/// Construct a new vector, using the provided values.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new($($field: S),+) -> $VectorN<S> {
|
pub const fn new($($field: S),+) -> $VectorN<S> {
|
||||||
$VectorN { $($field: $field),+ }
|
$VectorN { $($field: $field),+ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue