Closed lwp001 closed 2 months ago
Welcome to the wonderful world of javascript (though tbf this problem applies to all languages). I'd recommend to change to rust side to either send the numbers as strings, or split them up into integers. Then on the js side, either use them as strings too, or try to convert them to BigInt.
Anyway, this is not a tauri specific problem so general resources you can find on this topic on the internet should apply here too.
thanks
Describe the bug
[derive(Debug, Serialize)]
pub struct DpfOrScr { pub utc: String, pub speed: f64, pub atmospheric_pressure: f64, pub torque: i16, pub friction_torque: i16, pub engine_speed: f64, pub fuel_flow: f64, pub scr_up_nox: f64, pub scr_down_nox: f64, pub reagent_surplus: f64, pub air_inflow: f64, pub scr_entrance_temperature: f64, pub scr_export_temperature: f64, pub dpf_diference_pressure: f64, pub coolant_temperature: i16, pub liquid_level: f32, pub egr: f64, pub egr_set: f64, }
[tauri::command]
fn greet(name: &str) -> DpfOrScr { // format!("Hello, {}! You've been greeted from Rust!", name) DpfOrScr { utc:"2024-08-01 11:00:39".to_string(), speed:5.09765625, atmospheric_pressure:97.0, torque:22, friction_torque:11, engine_speed:746.0, fuel_flow:4.3, scr_up_nox:0.0307675, scr_down_nox:0.030767500000000003, reagent_surplus:47.2, air_inflow:229.0, scr_entrance_temperature:85.3125, scr_export_temperature:1774.96875, dpf_diference_pressure:0.2, coolant_temperature:35, liquid_level:13.6,
egr:163.0, egr_set:163.8375 } }
front view
{ "air_inflow": 229, "atmospheric_pressure": 97, "coolant_temperature": 35, "dpf_diference_pressure": 0.2, "egr": 163, "egr_set": 163.8375, "engine_speed": 746, "friction_torque": 11, "fuel_flow": 4.3,
"liquid_level": 13.600000381469727,
"reagent_surplus": 47.2, "scr_down_nox": 0.030767500000000003, "scr_entrance_temperature": 85.3125, "scr_export_temperature": 1774.96875, "scr_up_nox": 0.0307675, "speed": 5.09765625, "torque": 22, "utc": "2024-08-01 11:00:39" }
Reproduction
No response
Expected behavior
13.6 ===>13.6
Full
tauri info
outputStack trace
No response
Additional context
No response