I'm not very familiar with Rust, but BrokerCommand returns double, not int. Maybe your implementation returns strange values because of a wrong return type.