1- use urid:: { URIDCollection , Map } ;
2- use crate :: request:: OptionRequestList ;
3- use crate :: { OptionsError , OptionValue } ;
41use crate :: list:: OptionsList ;
52use crate :: option:: request:: OptionRequest ;
3+ use crate :: request:: OptionRequestList ;
4+ use crate :: { OptionValue , OptionsError } ;
5+ use urid:: { Map , URIDCollection } ;
66
77pub trait OptionsCollection : Sized {
88 type Serializer ;
99
1010 #[ inline]
1111 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+ } )
1419 }
1520}
1621
1722#[ doc( hidden) ]
1823pub 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 } ;
2325 use crate :: option:: request:: OptionRequest ;
26+ use crate :: { OptionType , OptionValue , OptionsError } ;
27+ use lv2_atom:: atoms:: scalar:: ScalarAtom ;
2428 use lv2_atom:: { Atom , BackAsSpace } ;
25- use lv2_atom:: scalar:: ScalarAtom ;
29+ use std:: marker:: PhantomData ;
30+ use urid:: { Map , URIDCollection , URID } ;
2631
2732 pub struct OptionTypeSerializationContext < O : OptionType > {
2833 option_urid : URID < O > ,
29- option_type_atom_urid : URID < O :: AtomType >
34+ option_type_atom_urid : URID < O :: AtomType > ,
3035 }
3136
3237 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+ {
3541 type Serializer = OptionTypeSerializationContext < O > ;
3642 }
3743
@@ -46,25 +52,34 @@ pub mod implementation {
4652 }
4753
4854 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+ {
5158 #[ inline]
5259 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 )
5461 }
5562
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 > {
5768 todo ! ( )
5869 }
5970
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 > {
6176 todo ! ( )
6277 }
6378 }
6479}
6580
6681pub struct OptionsSerializer < T : OptionsCollection > {
67- inner : T :: Serializer
82+ inner : T :: Serializer ,
6883}
6984
7085impl < T : OptionsCollection > OptionsSerializer < T > {
@@ -76,7 +91,11 @@ impl<T: OptionsCollection> OptionsSerializer<T> {
7691 todo ! ( )
7792 }
7893
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 > {
8099 todo ! ( )
81100 }
82101}
@@ -86,5 +105,9 @@ pub trait OptionsSerializationContext<'a, T: OptionsCollection>: URIDCollection
86105
87106 fn deserialize_to ( & self , options : & mut T , option : & OptionValue ) -> Result < ( ) , OptionsError > ;
88107
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