Skip to content

Refactor the DiscreteRanged trait #80

@38

Description

@38

Background

Now the discrete range trait doesn't seem clean because of the following issue:

  • No bound check, the next_value and previous_value requires always returns a value
  • Unknown number of distinct values
  • Linspace coord should be a discrete range, however this can't be used in Histogram since the hash table requires Equal trait but f64 doesn't impl the trait.

However, all the discrete range is equivalent to a integer range, thus we doesn't actually need put any restriction on the traits for the actual values. (Later we may use an array as an discrete coordinate and lifting the trait bound will make this possible)

Drawbacks

In order to know the number of values and handle the bound correctly, we have to make most of the RangeParam not an unit type, and this will makes Histogram::new unsable to applied to most of the coord types. Thus this should be considered as an breaking change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions