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} ;
@@ -94,6 +95,7 @@ pub fn xioctl_valid<T>(fd: RawFd, request: usize, arg: &mut T) -> io::Result<boo
9495 }
9596}
9697
98+ #[ derive( Debug ) ]
9799pub struct MappedRegion {
98100 pub ptr : * mut u8 ,
99101 pub len : usize ,
@@ -130,12 +132,15 @@ pub fn mmap(length: usize, fd: RawFd, offset: usize) -> io::Result<MappedRegion>
130132 } )
131133}
132134
135+ #[ derive( Derivative ) ]
136+ #[ derivative( Debug ) ]
133137#[ repr( C ) ]
134138pub struct Format {
135139 pub ftype : u32 ,
136140 #[ cfg( target_pointer_width = "64" ) ]
137141 padding : u32 ,
138142 pub fmt : PixFormat ,
143+ #[ derivative( Debug ="ignore" ) ]
139144 space : [ u8 ; 156 ] ,
140145}
141146
@@ -160,6 +165,7 @@ impl Format {
160165 }
161166}
162167
168+ #[ derive( Debug ) ]
163169#[ repr( C ) ]
164170pub struct PixFormat {
165171 pub width : u32 ,
@@ -186,6 +192,7 @@ impl PixFormat {
186192 }
187193}
188194
195+ #[ derive( Debug ) ]
189196#[ repr( C ) ]
190197pub struct RequestBuffers {
191198 pub count : u32 ,
@@ -205,13 +212,16 @@ impl RequestBuffers {
205212 }
206213}
207214
215+ #[ derive( Derivative ) ]
216+ #[ derivative( Debug ) ]
208217#[ repr( C ) ]
209218pub struct Buffer {
210219 pub index : u32 ,
211220 pub btype : u32 ,
212221 pub bytesused : u32 ,
213222 pub flags : u32 ,
214223 pub field : u32 ,
224+ #[ derivative( Debug ="ignore" ) ]
215225 pub timestamp : Timeval ,
216226 pub timecode : TimeCode ,
217227 pub sequence : u32 ,
@@ -231,6 +241,7 @@ impl Buffer {
231241 }
232242}
233243
244+ #[ derive( Debug ) ]
234245#[ repr( C ) ]
235246pub struct TimeCode {
236247 pub ttype : u32 ,
@@ -242,6 +253,7 @@ pub struct TimeCode {
242253 pub userbits : [ u8 ; 4 ] ,
243254}
244255
256+ #[ derive( Debug ) ]
245257#[ repr( C ) ]
246258pub struct FmtDesc {
247259 pub index : u32 ,
@@ -260,10 +272,13 @@ impl FmtDesc {
260272 }
261273}
262274
275+ #[ derive( Derivative ) ]
276+ #[ derivative( Debug ) ]
263277#[ repr( C ) ]
264278pub struct StreamParm {
265279 pub ptype : u32 ,
266280 pub parm : CaptureParm ,
281+ #[ derivative( Debug ="ignore" ) ]
267282 space : [ u8 ; 160 ] ,
268283}
269284
@@ -277,6 +292,7 @@ impl StreamParm {
277292 }
278293}
279294
295+ #[ derive( Debug ) ]
280296#[ repr( C ) ]
281297pub struct CaptureParm {
282298 pub capability : u32 ,
@@ -287,12 +303,14 @@ pub struct CaptureParm {
287303 reserved : [ u32 ; 4 ] ,
288304}
289305
306+ #[ derive( Debug ) ]
290307#[ repr( C ) ]
291308pub struct Fract {
292309 pub numerator : u32 ,
293310 pub denominator : u32 ,
294311}
295312
313+ #[ derive( Debug ) ]
296314#[ repr( C ) ]
297315pub struct Frmsizeenum {
298316 pub index : u32 ,
@@ -318,12 +336,14 @@ impl Frmsizeenum {
318336 }
319337}
320338
339+ #[ derive( Debug ) ]
321340#[ repr( C ) ]
322341pub struct FrmsizeDiscrete {
323342 pub width : u32 ,
324343 pub height : u32 ,
325344}
326345
346+ #[ derive( Debug ) ]
327347#[ repr( C ) ]
328348pub struct FrmsizeStepwise {
329349 pub min_width : u32 ,
@@ -334,6 +354,7 @@ pub struct FrmsizeStepwise {
334354 pub step_height : u32 ,
335355}
336356
357+ #[ derive( Debug ) ]
337358#[ repr( C ) ]
338359pub struct Frmivalenum {
339360 pub index : u32 ,
@@ -363,13 +384,15 @@ impl Frmivalenum {
363384 }
364385}
365386
387+ #[ derive( Debug ) ]
366388#[ repr( C ) ]
367389pub struct FrmivalStepwise {
368390 pub min : Fract ,
369391 pub max : Fract ,
370392 pub step : Fract ,
371393}
372394
395+ #[ derive( Debug ) ]
373396#[ repr( C ) ]
374397pub struct QueryCtrl {
375398 pub id : u32 ,
@@ -391,6 +414,7 @@ impl QueryCtrl {
391414 }
392415}
393416
417+ #[ derive( Debug ) ]
394418#[ repr( C ) ]
395419pub struct QueryExtCtrl {
396420 pub id : u32 ,
@@ -418,6 +442,7 @@ impl QueryExtCtrl {
418442 }
419443}
420444
445+ #[ derive( Debug , Copy , Clone ) ]
421446#[ repr( C , packed) ]
422447pub struct QueryMenu {
423448 pub id : u32 ,
@@ -426,12 +451,19 @@ pub struct QueryMenu {
426451 reserved : u32 ,
427452}
428453
454+ #[ derive( Copy , Clone ) ]
429455#[ repr( C , packed) ]
430456pub union QueryMenuData {
431457 name : [ u8 ; 32 ] ,
432458 value : i64 ,
433459}
434460
461+ impl fmt:: Debug for QueryMenuData {
462+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
463+ write ! ( f, "{:?}" , self . name( ) )
464+ }
465+ }
466+
435467impl QueryMenu {
436468 pub fn new ( id : u32 ) -> QueryMenu {
437469 let mut menu: QueryMenu = unsafe { mem:: zeroed ( ) } ;
@@ -450,6 +482,7 @@ impl QueryMenuData {
450482 }
451483}
452484
485+ #[ derive( Debug ) ]
453486#[ repr( C ) ]
454487pub struct Control {
455488 pub id : u32 ,
@@ -462,6 +495,7 @@ impl Control {
462495 }
463496}
464497
498+ #[ derive( Debug , Copy , Clone ) ]
465499#[ repr( C , packed) ]
466500pub struct ExtControl {
467501 pub id : u32 ,
@@ -481,6 +515,7 @@ impl ExtControl {
481515 }
482516}
483517
518+ #[ derive( Debug ) ]
484519#[ repr( C ) ]
485520pub struct ExtControls < ' a > {
486521 pub ctrl_class : u32 ,
0 commit comments