aerospike / aerospike-client-rust

Rust client for the Aerospike database
https://www.aerospike.com/
Other
82 stars 29 forks source link

FloatValue enum uses u32 and u64 types instead of f32 and f64 #54

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hi!

I'm trying to use FloatValue and it looks weird that it has u32 and u64 in the enum declaration instead of f32 and f64 correspondingly:

https://github.com/aerospike/aerospike-client-rust/blob/430780ae408a1e224b9ad3a232db36d61099ad3a/src/value.rs#L35-L42

So in order to use for example f32 value it is necessary to invoke mem::transmute_copy::<u32, f32>.

jhecking commented 5 years ago

Sorry for the late response.

FloatValue implements From<f32> so you can just call FloatValue::from(f32) to get a FloatValue from an f32.

If you just want to convert your f32 into a Value object, you can also use the as_val! macro.