11#![ allow( clippy:: unreadable_literal) ]
22
33use std:: ffi:: CString ;
4+ use std:: fmt;
45use std:: os:: unix:: io:: RawFd ;
56use std:: ptr:: null_mut;
67use std:: { io, mem, usize} ;
@@ -132,12 +133,15 @@ pub fn mmap(length: usize, fd: RawFd, offset: usize) -> io::Result<MappedRegion>
132133 } )
133134}
134135
136+ #[ derive( Derivative ) ]
137+ #[ derivative( Debug ) ]
135138#[ repr( C ) ]
136139pub struct Format {
137140 pub ftype : u32 ,
138141 #[ cfg( target_pointer_width = "64" ) ]
139142 padding : u32 ,
140143 pub fmt : PixFormat ,
144+ #[ derivative( Debug ="ignore" ) ]
141145 space : [ u8 ; 156 ] ,
142146}
143147
@@ -162,6 +166,7 @@ impl Format {
162166 }
163167}
164168
169+ #[ derive( Debug ) ]
165170#[ repr( C ) ]
166171pub struct PixFormat {
167172 pub width : u32 ,
@@ -188,6 +193,7 @@ impl PixFormat {
188193 }
189194}
190195
196+ #[ derive( Debug ) ]
191197#[ repr( C ) ]
192198pub struct RequestBuffers {
193199 pub count : u32 ,
@@ -207,13 +213,16 @@ impl RequestBuffers {
207213 }
208214}
209215
216+ #[ derive( Derivative ) ]
217+ #[ derivative( Debug ) ]
210218#[ repr( C ) ]
211219pub struct Buffer {
212220 pub index : u32 ,
213221 pub btype : u32 ,
214222 pub bytesused : u32 ,
215223 pub flags : u32 ,
216224 pub field : u32 ,
225+ #[ derivative( Debug ="ignore" ) ]
217226 pub timestamp : Timeval ,
218227 pub timecode : TimeCode ,
219228 pub sequence : u32 ,
@@ -233,6 +242,7 @@ impl Buffer {
233242 }
234243}
235244
245+ #[ derive( Debug ) ]
236246#[ repr( C ) ]
237247pub struct TimeCode {
238248 pub ttype : u32 ,
@@ -244,6 +254,7 @@ pub struct TimeCode {
244254 pub userbits : [ u8 ; 4 ] ,
245255}
246256
257+ #[ derive( Debug ) ]
247258#[ repr( C ) ]
248259pub struct FmtDesc {
249260 pub index : u32 ,
@@ -262,10 +273,13 @@ impl FmtDesc {
262273 }
263274}
264275
276+ #[ derive( Derivative ) ]
277+ #[ derivative( Debug ) ]
265278#[ repr( C ) ]
266279pub struct StreamParm {
267280 pub ptype : u32 ,
268281 pub parm : CaptureParm ,
282+ #[ derivative( Debug ="ignore" ) ]
269283 space : [ u8 ; 160 ] ,
270284}
271285
@@ -279,6 +293,7 @@ impl StreamParm {
279293 }
280294}
281295
296+ #[ derive( Debug ) ]
282297#[ repr( C ) ]
283298pub struct CaptureParm {
284299 pub capability : u32 ,
@@ -289,12 +304,14 @@ pub struct CaptureParm {
289304 reserved : [ u32 ; 4 ] ,
290305}
291306
307+ #[ derive( Debug ) ]
292308#[ repr( C ) ]
293309pub struct Fract {
294310 pub numerator : u32 ,
295311 pub denominator : u32 ,
296312}
297313
314+ #[ derive( Debug ) ]
298315#[ repr( C ) ]
299316pub struct Frmsizeenum {
300317 pub index : u32 ,
@@ -320,12 +337,14 @@ impl Frmsizeenum {
320337 }
321338}
322339
340+ #[ derive( Debug ) ]
323341#[ repr( C ) ]
324342pub struct FrmsizeDiscrete {
325343 pub width : u32 ,
326344 pub height : u32 ,
327345}
328346
347+ #[ derive( Debug ) ]
329348#[ repr( C ) ]
330349pub struct FrmsizeStepwise {
331350 pub min_width : u32 ,
@@ -336,6 +355,7 @@ pub struct FrmsizeStepwise {
336355 pub step_height : u32 ,
337356}
338357
358+ #[ derive( Debug ) ]
339359#[ repr( C ) ]
340360pub struct Frmivalenum {
341361 pub index : u32 ,
@@ -365,13 +385,15 @@ impl Frmivalenum {
365385 }
366386}
367387
388+ #[ derive( Debug ) ]
368389#[ repr( C ) ]
369390pub struct FrmivalStepwise {
370391 pub min : Fract ,
371392 pub max : Fract ,
372393 pub step : Fract ,
373394}
374395
396+ #[ derive( Debug ) ]
375397#[ repr( C ) ]
376398pub struct QueryCtrl {
377399 pub id : u32 ,
@@ -393,6 +415,7 @@ impl QueryCtrl {
393415 }
394416}
395417
418+ #[ derive( Debug ) ]
396419#[ repr( C ) ]
397420pub struct QueryExtCtrl {
398421 pub id : u32 ,
@@ -420,6 +443,7 @@ impl QueryExtCtrl {
420443 }
421444}
422445
446+ #[ derive( Debug ) ]
423447#[ repr( C , packed) ]
424448pub struct QueryMenu {
425449 pub id : u32 ,
@@ -434,6 +458,12 @@ pub union QueryMenuData {
434458 value : i64 ,
435459}
436460
461+ impl fmt:: Debug for QueryMenuData {
462+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
463+ write ! ( f, "{:?}" , self . name( ) )
464+ }
465+ }
466+
437467impl QueryMenu {
438468 pub fn new ( id : u32 ) -> QueryMenu {
439469 let mut menu: QueryMenu = unsafe { mem:: zeroed ( ) } ;
@@ -452,6 +482,7 @@ impl QueryMenuData {
452482 }
453483}
454484
485+ #[ derive( Debug ) ]
455486#[ repr( C ) ]
456487pub struct Control {
457488 pub id : u32 ,
@@ -464,6 +495,7 @@ impl Control {
464495 }
465496}
466497
498+ #[ derive( Debug ) ]
467499#[ repr( C , packed) ]
468500pub struct ExtControl {
469501 pub id : u32 ,
@@ -483,6 +515,7 @@ impl ExtControl {
483515 }
484516}
485517
518+ #[ derive( Debug ) ]
486519#[ repr( C ) ]
487520pub struct ExtControls < ' a > {
488521 pub ctrl_class : u32 ,
0 commit comments