rustneo4jbolt

Neo4rs BoltType Float f64


I am using Neo4rs and I'm having troubles with floats. The following code

let mut result = graph.execute(
            query("CREATE (p:PERSON {height: $height}) RETURN p")
                .param("height", person.height)

Where person.height is a f64, will not compile due to

the trait bound `neo4rs::types::BoltType: std::convert::From<f64>` is not satisfied

Although, when I look at the repo, it does seem like it is implemented. I've been converting floats to strings and then back to floats but I think I am missing something obvious.


Solution

  • Although, when I look at the repo, it does seem like it is implemented.

    Where do you see that? Because all I can see is a way to convert from BoltType to f64 (so get f64 out of bolt I guess), not from f64 into BoltType.

    In fact there is an open PR which wants to add an f64->BoltType conversion (alongside conversion of BoltType from and into Vec).