@@ -7,11 +7,11 @@ use serde::{
77 de:: { DeserializeSeed , Error , Visitor } ,
88} ;
99use zvariant:: {
10- self , Array , DeserializeDict , DynamicDeserialize , LE , NoneValue , Optional , OwnedValue ,
10+ self , Array , DeserializeDict , DynamicDeserialize , NoneValue , Optional , OwnedValue ,
1111 SerializeDict , Signature , Structure , StructureBuilder , Type , Value , signature:: Fields ,
1212} ;
1313
14- use crate :: model:: { BackgroundEvent , Operation , RequestingApplication } ;
14+ use crate :: model:: { BackgroundEvent , Device , Operation , RequestingApplication } ;
1515
1616const TAG_VALUE_SIGNATURE : & Signature = & Signature :: Structure ( Fields :: Static {
1717 fields : & [ & Signature :: U8 , & Signature :: Variant ] ,
@@ -175,43 +175,6 @@ impl From<crate::model::Credential> for Credential {
175175 }
176176}
177177
178- #[ derive( SerializeDict , DeserializeDict , Type ) ]
179- #[ zvariant( signature = "a{sv}" ) ]
180- pub struct Device {
181- pub id : String ,
182- pub transport : String ,
183- }
184-
185- impl TryFrom < Value < ' _ > > for Device {
186- type Error = zvariant:: Error ;
187- fn try_from ( value : Value < ' _ > ) -> std:: result:: Result < Self , Self :: Error > {
188- let ctx = zvariant:: serialized:: Context :: new_dbus ( LE , 0 ) ;
189- let encoded = zvariant:: to_bytes ( ctx, & value) ?;
190- let device: Device = encoded. deserialize ( ) ?. 0 ;
191- Ok ( device)
192- }
193- }
194-
195- impl From < crate :: model:: Device > for Device {
196- fn from ( value : crate :: model:: Device ) -> Self {
197- Device {
198- id : value. id ,
199- transport : value. transport . as_str ( ) . to_owned ( ) ,
200- }
201- }
202- }
203-
204- impl TryFrom < Device > for crate :: model:: Device {
205- type Error = ( ) ;
206- fn try_from ( value : Device ) -> std:: result:: Result < Self , Self :: Error > {
207- let transport = value. transport . try_into ( ) . map_err ( |_| ( ) ) ?;
208- Ok ( Self {
209- id : value. id ,
210- transport,
211- } )
212- }
213- }
214-
215178impl TryFrom < & Value < ' _ > > for crate :: model:: Error {
216179 type Error = zvariant:: Error ;
217180
0 commit comments