Skip to content

Conversion/Casts considerations #88

Open
@Patiga

Description

@Patiga

Context: I'm using vek in combination with fixed point numbers. In case you are curious, the project I'm working on is twmap (and the few other things I build on top of it).

Vec2 currently has numcast as its main method of conversion afaik.
numcast relies on Numcast, which fixed doesn't implement (reasoning).

Conversion methods which I think could be added

  • Two methods using ToPrimitive and FromPrimitive (I guess also AsPrimitive if you want to be thorough)
  • From, Into, TryFrom and TryInto based conversion. I personally don't need them yet, but I can see me needing them in the future. Implementing the trait is not possible, but methods using the traits could help.
  • The az crate has a nice set of conversion traits. These are not implemented generically and thus can be implemented. fixed supports them, but otherwise az doesn't have that many downloads.

Like last time, I'm willing to put my own time into this, but I won't stop you if you judge that it's worth your time :)
I'll continue opening issues for non-trivial things, as you suggest in the README

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions