@@ -3,16 +3,14 @@ use std::{
33 sync:: { LazyLock , Mutex } ,
44} ;
55
6- use crate :: middleware:: {
7- BackendResult , Error , Hash , Params , Pod , PodId , PodType , RecursivePod , Result ,
8- } ;
6+ use crate :: middleware:: { DynError , Error , Hash , Params , Pod , PodId , PodType , RecursivePod , Result } ;
97
108type DeserializeFn = fn (
119 params : Params ,
12- id : PodId ,
13- vds_root : Hash ,
1410 data : serde_json:: Value ,
15- ) -> BackendResult < Box < dyn RecursivePod > > ;
11+ vds_root : Hash ,
12+ id : PodId ,
13+ ) -> Result < Box < dyn RecursivePod > , Box < DynError > > ;
1614
1715static DESERIALIZERS : LazyLock < Mutex < HashMap < usize , DeserializeFn > > > =
1816 LazyLock :: new ( backend:: deserializers_default) ;
@@ -41,7 +39,7 @@ pub fn deserialize_pod(
4139 pod_type
4240 ) ) ) ?;
4341
44- deserialize_fn ( params, id , vds_root, data )
42+ deserialize_fn ( params, data , vds_root, id )
4543 . map_err ( |e| Error :: custom ( format ! ( "deserialize error: {:?}" , e) ) )
4644}
4745
@@ -65,10 +63,10 @@ mod backend {
6563
6664 pub ( super ) fn deserializers_default ( ) -> Mutex < HashMap < usize , DeserializeFn > > {
6765 let mut map: HashMap < usize , DeserializeFn > = HashMap :: new ( ) ;
68- map. insert ( PodType :: Empty as usize , EmptyPod :: deserialize ) ;
69- map. insert ( PodType :: Main as usize , MainPod :: deserialize ) ;
70- map. insert ( PodType :: MockEmpty as usize , MockEmptyPod :: deserialize ) ;
71- map. insert ( PodType :: MockMain as usize , MockMainPod :: deserialize ) ;
66+ map. insert ( PodType :: Empty as usize , EmptyPod :: deserialize_data ) ;
67+ map. insert ( PodType :: Main as usize , MainPod :: deserialize_data ) ;
68+ map. insert ( PodType :: MockEmpty as usize , MockEmptyPod :: deserialize_data ) ;
69+ map. insert ( PodType :: MockMain as usize , MockMainPod :: deserialize_data ) ;
7270 Mutex :: new ( map)
7371 }
7472
0 commit comments