Skip to content

Hierarchy for atomic types / precise casting? #24

@vigna

Description

@vigna

Thank you for a much needed crate!

We have been very successful in replacing the type hierarchy in common_traits with num-primitive and num-crates in dsi-bitstream.

We were wondering if there's in the works something like num-primitive for atomic types (or we could try to write one).

Another thing that would be nice to have is a trait for conversion without loss of precision, like in az::StrictCast or common_traits::UpcastableInto. One can convert, say, between signed and unsigned types of the same size with a bit of juggling and AsPrimitive, but I haven't found any way to write a bound implying "this can be cast into a u32 without loss of precision".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions