dimforge / dimforge/nalgebra

`const fn` constructors

Open
#521 8 comments 3 reactions 0 assignees View on GitHub
enhancement good first issue P-high
Dominant language
Rust
Stars
4.8k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

`const fn` [has landed in Rust stable][pg]! It would be really helpful in one of my projects if nalgebra adopted it for constructors. The shortlist of types I need is `Point2`, `Point3`, `Vector2`, `Vector3`, `UnitComplex`, `UnitQuaternion`. But it probably makes sense for every type in the library.

[pg]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=bfe2c142b24c209a11aa7f6d0da729e4

Things like `UnitComplex::new` might not work due to compile-time restrictions on FP math, but I'm happy to work around that with `UnitComplex::from_cos_sin_unchecked` or whatever else makes sense.

Adding the keyword is a simple enough change (at least I hope!), but it will break on older compilers and I don't know your policy on Rust version compatibility.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.