pub fn save_to_storage(world_state: &WorldState) -> Result<(), JsValue> {
    let local_storage = try_local_storage()?;

    let data = serde_json::to_string(world_state).map_err(|e| JsValue::from(e.to_string()))?;

    local_storage.set_item("save", &data)?;

    Ok(())
}
/// Save the whole state of the game onto local storage.
Save the whole state of the game onto local storage.
Save the whole state of the game onto local storage .
pub fn save_to_storage(world_state: &WorldState) -> Result<(), JsValue> {
    let local_storage = try_local_storage()?;
    let data = serde_json::to_string(world_state).map_err(|e| JsValue::from(e.to_string()))?;
    local_storage.set_item("save", &data)?;
    Ok(())
}
pub fn save_to_storage ( world_state : & WorldState ) -> Result < ( ) , JsValue > { let local_storage = try_local_storage ( ) ? ; let data = serde_json :: to_string ( world_state ) . map_err ( | e | JsValue :: from ( e . to_string ( ) ) ) ? ; local_storage . set_item ( " " , & data ) ? ; Ok ( ( ) ) }
Save the whole state of the game onto local storage.
Save the whole state of the game onto local storage .
world_state
&WorldState
world_state
&WorldState