Skip to content

const fn constructors #521

Open
Open
@whatisaphone

Description

@whatisaphone

const fn has landed in Rust stable! 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.

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions