facebook / starlark-rust

A Rust implementation of the Starlark language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

impl UnpackValue for f64

benmkw opened this issue · comments

When writing a rust function which should be called by stacklack which accepts a float one currently one has to accept a Value and then do

val.unpack_num().unwrap().as_float()

The error message if one uses a float in a #[starlark_module] is somewhat surprising because floats are listed as primitives https://github.com/bazelbuild/starlark/blob/master/spec.md#data-types

Agreed, I'll write a patch now. Floats got added latter, so I guess this got missed.

Done in 4b7005e.