Skip to content

NumOrString trait not implemented for f32 #47

@crystal-growth

Description

@crystal-growth

NumOfString trait implementation is missing for f32 type, preventing from using it in defining axis ranges:

let (xmin:f32, xmax:f32) = some_func();
...
let layout = plotly::Layout::new()
 .x_axis(Axis::new().range(vec![xmin, xmax]).auto_range(false))

results in compilation error:

the trait `ptly::plotly::private::NumOrString` is not implemented for `f32`

requiring manually casting f32 to f64:

...
.x_axis(Axis::new().range(vec![xmin as f64, xmax as f64]).auto_range(false))
...

that looks less ergonomic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions