1
- use urid:: { URIDCollection , Map } ;
2
- use crate :: request:: OptionRequestList ;
3
- use crate :: { OptionsError , OptionValue } ;
4
1
use crate :: list:: OptionsList ;
5
2
use crate :: option:: request:: OptionRequest ;
3
+ use crate :: request:: OptionRequestList ;
4
+ use crate :: { OptionValue , OptionsError } ;
5
+ use urid:: { Map , URIDCollection } ;
6
6
7
7
pub trait OptionsCollection : Sized {
8
8
type Serializer ;
9
9
10
10
#[ inline]
11
11
fn new_serializer < ' a , M : Map + ?Sized > ( map : & M ) -> Option < OptionsSerializer < Self > >
12
- where Self :: Serializer : OptionsSerializationContext < ' a , Self > { // FIXME
13
- Some ( OptionsSerializer { inner : Self :: Serializer :: from_map ( map) ? } )
12
+ where
13
+ Self :: Serializer : OptionsSerializationContext < ' a , Self > ,
14
+ {
15
+ // FIXME
16
+ Some ( OptionsSerializer {
17
+ inner : Self :: Serializer :: from_map ( map) ?,
18
+ } )
14
19
}
15
20
}
16
21
17
22
#[ doc( hidden) ]
18
23
pub mod implementation {
19
- use crate :: { OptionType , OptionsError , OptionValue } ;
20
- use std:: marker:: PhantomData ;
21
- use urid:: { URID , URIDCollection , Map } ;
22
- use crate :: collection:: { OptionsSerializationContext , OptionsCollection } ;
24
+ use crate :: collection:: { OptionsCollection , OptionsSerializationContext } ;
23
25
use crate :: option:: request:: OptionRequest ;
26
+ use crate :: { OptionType , OptionValue , OptionsError } ;
27
+ use lv2_atom:: atoms:: scalar:: ScalarAtom ;
24
28
use lv2_atom:: { Atom , BackAsSpace } ;
25
- use lv2_atom:: scalar:: ScalarAtom ;
29
+ use std:: marker:: PhantomData ;
30
+ use urid:: { Map , URIDCollection , URID } ;
26
31
27
32
pub struct OptionTypeSerializationContext < O : OptionType > {
28
33
option_urid : URID < O > ,
29
- option_type_atom_urid : URID < O :: AtomType >
34
+ option_type_atom_urid : URID < O :: AtomType > ,
30
35
}
31
36
32
37
impl < ' a , O : OptionType > OptionsCollection for O
33
- where <O as OptionType >:: AtomType : BackAsSpace < ' a > ,
34
- <<O as OptionType >:: AtomType as Atom < ' a , ' a > >:: ReadParameter : Default {
38
+ where
39
+ <O as OptionType >:: AtomType : BackAsSpace ,
40
+ {
35
41
type Serializer = OptionTypeSerializationContext < O > ;
36
42
}
37
43
@@ -46,25 +52,34 @@ pub mod implementation {
46
52
}
47
53
48
54
impl < ' a , O : OptionType > OptionsSerializationContext < ' a , O > for OptionTypeSerializationContext < O >
49
- where <O as OptionType >:: AtomType : BackAsSpace < ' a > ,
50
- <<O as OptionType >:: AtomType as Atom < ' a , ' a > >:: ReadParameter : Default {
55
+ where
56
+ <O as OptionType >:: AtomType : BackAsSpace ,
57
+ {
51
58
#[ inline]
52
59
fn deserialize_new ( & self , option : & ' a OptionValue ) -> Option < O > {
53
- option. read ( self . option_urid , self . option_type_atom_urid , Default :: default ( ) )
60
+ option. read ( self . option_urid , self . option_type_atom_urid )
54
61
}
55
62
56
- fn deserialize_to ( & self , options : & mut O , option : & OptionValue ) -> Result < ( ) , OptionsError > {
63
+ fn deserialize_to (
64
+ & self ,
65
+ options : & mut O ,
66
+ option : & OptionValue ,
67
+ ) -> Result < ( ) , OptionsError > {
57
68
todo ! ( )
58
69
}
59
70
60
- fn respond_to_request < ' r > ( & self , options : & ' r O , requests : & ' r mut OptionRequest ) -> Result < ( ) , OptionsError > {
71
+ fn respond_to_request < ' r > (
72
+ & self ,
73
+ options : & ' r O ,
74
+ requests : & ' r mut OptionRequest ,
75
+ ) -> Result < ( ) , OptionsError > {
61
76
todo ! ( )
62
77
}
63
78
}
64
79
}
65
80
66
81
pub struct OptionsSerializer < T : OptionsCollection > {
67
- inner : T :: Serializer
82
+ inner : T :: Serializer ,
68
83
}
69
84
70
85
impl < T : OptionsCollection > OptionsSerializer < T > {
@@ -76,7 +91,11 @@ impl<T: OptionsCollection> OptionsSerializer<T> {
76
91
todo ! ( )
77
92
}
78
93
79
- pub fn respond_to_requests < ' a > ( & self , options : & T , requests : & mut OptionRequestList ) -> Result < ( ) , OptionsError > {
94
+ pub fn respond_to_requests < ' a > (
95
+ & self ,
96
+ options : & T ,
97
+ requests : & mut OptionRequestList ,
98
+ ) -> Result < ( ) , OptionsError > {
80
99
todo ! ( )
81
100
}
82
101
}
@@ -86,5 +105,9 @@ pub trait OptionsSerializationContext<'a, T: OptionsCollection>: URIDCollection
86
105
87
106
fn deserialize_to ( & self , options : & mut T , option : & OptionValue ) -> Result < ( ) , OptionsError > ;
88
107
89
- fn respond_to_request < ' r > ( & self , options : & ' r T , request : & ' r mut OptionRequest ) -> Result < ( ) , OptionsError > ;
90
- }
108
+ fn respond_to_request < ' r > (
109
+ & self ,
110
+ options : & ' r T ,
111
+ request : & ' r mut OptionRequest ,
112
+ ) -> Result < ( ) , OptionsError > ;
113
+ }
0 commit comments