11use apdu_dispatch:: app:: { App , CommandView , Result as AppResult } ;
22use apdu_dispatch:: dispatch;
33use apdu_dispatch:: { interchanges, response} ;
4+ use heapless:: VecView ;
45use hex_literal:: hex;
56use interchange:: Channel ;
67use iso7816:: Status ;
@@ -47,12 +48,12 @@ impl iso7816::App for TestApp1 {
4748}
4849
4950// This app echos to Ins code 0x10
50- impl App < { apdu_dispatch :: response :: SIZE } > for TestApp1 {
51+ impl App for TestApp1 {
5152 fn select (
5253 & mut self ,
5354 _interface : dispatch:: Interface ,
5455 _apdu : CommandView < ' _ > ,
55- _reply : & mut response :: Data ,
56+ _reply : & mut VecView < u8 > ,
5657 ) -> AppResult {
5758 Ok ( ( ) )
5859 }
@@ -63,7 +64,7 @@ impl App<{ apdu_dispatch::response::SIZE }> for TestApp1 {
6364 & mut self ,
6465 _: dispatch:: Interface ,
6566 apdu : CommandView < ' _ > ,
66- reply : & mut response :: Data ,
67+ reply : & mut VecView < u8 > ,
6768 ) -> AppResult {
6869 println ! ( "TestApp1::call" ) ;
6970 match apdu. instruction ( ) . into ( ) {
@@ -79,8 +80,8 @@ impl App<{ apdu_dispatch::response::SIZE }> for TestApp1 {
7980 }
8081 // For measuring the stack burden of dispatch
8182 0x15 => {
82- let buf = heapless:: Vec :: new ( ) ;
83- let addr = ( & buf as * const response :: Data ) as u32 ;
83+ let buf = heapless:: Vec :: < u8 , { response :: SIZE } > :: new ( ) ;
84+ let addr = ( & buf as * const VecView < u8 > ) . addr ( ) as u32 ;
8485 reply. extend_from_slice ( & addr. to_be_bytes ( ) ) . unwrap ( ) ;
8586 Ok ( ( ) )
8687 }
@@ -122,12 +123,12 @@ impl iso7816::App for TestApp2 {
122123}
123124
124125// This app echos to Ins code 0x20
125- impl App < { apdu_dispatch :: response :: SIZE } > for TestApp2 {
126+ impl App for TestApp2 {
126127 fn select (
127128 & mut self ,
128129 _interface : dispatch:: Interface ,
129130 _apdu : CommandView < ' _ > ,
130- _reply : & mut response :: Data ,
131+ _reply : & mut VecView < u8 > ,
131132 ) -> AppResult {
132133 Ok ( ( ) )
133134 }
@@ -138,7 +139,7 @@ impl App<{ apdu_dispatch::response::SIZE }> for TestApp2 {
138139 & mut self ,
139140 _: dispatch:: Interface ,
140141 apdu : CommandView < ' _ > ,
141- reply : & mut response :: Data ,
142+ reply : & mut VecView < u8 > ,
142143 ) -> AppResult {
143144 println ! ( "TestApp2::call" ) ;
144145 match apdu. instruction ( ) . into ( ) {
@@ -174,12 +175,12 @@ impl iso7816::App for PanicApp {
174175}
175176
176177// This app echos to Ins code 0x20
177- impl App < { apdu_dispatch :: response :: SIZE } > for PanicApp {
178+ impl App for PanicApp {
178179 fn select (
179180 & mut self ,
180181 _interface : dispatch:: Interface ,
181182 _apdu : CommandView < ' _ > ,
182- _reply : & mut response :: Data ,
183+ _reply : & mut VecView < u8 > ,
183184 ) -> AppResult {
184185 panic ! ( "Dont call the panic app" ) ;
185186 }
@@ -192,7 +193,7 @@ impl App<{ apdu_dispatch::response::SIZE }> for PanicApp {
192193 & mut self ,
193194 _: dispatch:: Interface ,
194195 _apdu : CommandView < ' _ > ,
195- _reply : & mut response :: Data ,
196+ _reply : & mut VecView < u8 > ,
196197 ) -> AppResult {
197198 panic ! ( "Dont call the panic app" ) ;
198199 }
0 commit comments