Skip to content

Need numeric trait for converting to Option<uint> #8605

Closed
@lilyball

Description

@lilyball

In order to implement size_hint() on Range, we need some numeric trait that covers the ability to convert a given type to uint (or more generally, Option<uint>, to cover out of bounds conversions).

More specifically, we need to convert the result of a - b where a and b are values of the numeric type. The definition for this conversion to uint would be the number of times that you'd have to add One::one() to the result to get a back (which is the obvious definition, really).

This is needed because range() doesn't restrict its inputs to primitive numeric types.

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