File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 1+ use std:: collections:: BTreeMap ;
2+ use tauri_plugin_svelte:: { Marshaler , MarshalingError , StoreState } ;
3+
4+ pub struct JsonMarshaler ;
5+
6+ impl Marshaler for JsonMarshaler {
7+ fn serialize ( & self , state : & StoreState ) -> Result < Vec < u8 > , MarshalingError > {
8+ let ordered: BTreeMap < _ , _ > = state. entries ( ) . collect ( ) ;
9+ Ok ( serde_json:: to_vec_pretty ( & ordered) ?)
10+ }
11+
12+ fn deserialize ( & self , bytes : & [ u8 ] ) -> Result < StoreState , MarshalingError > {
13+ Ok ( serde_json:: from_slice ( bytes) ?)
14+ }
15+
16+ fn extension ( & self ) -> & ' static str {
17+ "json"
18+ }
19+ }
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ use tauri::async_runtime::{self, Mutex};
1111use tauri:: ipc:: Invoke ;
1212use tauri:: { Manager , WindowEvent } ;
1313use tauri_plugin_cache:: { CacheConfig , CompressionMethod } ;
14- use tauri_plugin_svelte:: { ManagerExt , PrettyJsonMarshaler } ;
14+ use tauri_plugin_svelte:: ManagerExt ;
1515use twitch_api:: HelixClient ;
1616use twitch_api:: twitch_oauth2:: { AccessToken , UserToken } ;
1717
@@ -20,6 +20,7 @@ mod commands;
2020mod error;
2121mod eventsub;
2222mod irc;
23+ mod json;
2324mod log;
2425mod server;
2526mod seventv;
@@ -94,7 +95,7 @@ pub fn run() {
9495
9596 let svelte = tauri_plugin_svelte:: Builder :: new ( )
9697 . path ( app_handle. path ( ) . app_data_dir ( ) ?)
97- . marshaler ( Box :: new ( PrettyJsonMarshaler ) )
98+ . marshaler ( Box :: new ( json :: JsonMarshaler ) )
9899 . build ( ) ;
99100
100101 app_handle. plugin ( svelte) ?;
You can’t perform that action at this time.
0 commit comments