@@ -213,12 +213,12 @@ pub struct Header {
213
213
214
214
impl Field {
215
215
/// Returns this field's namespace.
216
- pub fn namespace ( & self ) -> & Namespace {
216
+ pub const fn namespace ( & self ) -> & Namespace {
217
217
& self . namespace
218
218
}
219
219
220
220
/// Returns this field's presence bit number.
221
- pub fn bit ( & self ) -> u32 {
221
+ pub const fn bit ( & self ) -> u32 {
222
222
self . bit
223
223
}
224
224
}
@@ -266,12 +266,12 @@ impl<'a> Iter<'a> {
266
266
}
267
267
268
268
/// Returns the version of the radiotap header.
269
- pub fn version ( & self ) -> u8 {
269
+ pub const fn version ( & self ) -> u8 {
270
270
VERSION
271
271
}
272
272
273
273
/// Returns the entire length of the radiotap header.
274
- pub fn length ( & self ) -> usize {
274
+ pub const fn length ( & self ) -> usize {
275
275
self . length
276
276
}
277
277
@@ -287,7 +287,7 @@ impl<'a> Iter<'a> {
287
287
///
288
288
/// let iter = radiotap::Iter::new(capture).unwrap().into_default();
289
289
/// ```
290
- pub fn into_default ( self ) -> IterDefault < ' a > {
290
+ pub const fn into_default ( self ) -> IterDefault < ' a > {
291
291
IterDefault { inner : self }
292
292
}
293
293
@@ -381,12 +381,14 @@ impl<'a> Iter<'a> {
381
381
382
382
impl IterDefault < ' _ > {
383
383
/// Returns the version of the radiotap header.
384
- pub fn version ( & self ) -> u8 {
384
+ #[ inline]
385
+ pub const fn version ( & self ) -> u8 {
385
386
self . inner . version ( )
386
387
}
387
388
388
389
/// Returns the entire length of the radiotap header.
389
- pub fn length ( & self ) -> usize {
390
+ #[ inline]
391
+ pub const fn length ( & self ) -> usize {
390
392
self . inner . length ( )
391
393
}
392
394
@@ -412,11 +414,13 @@ impl IterDefault<'_> {
412
414
}
413
415
414
416
/// Skip the given kind of field.
417
+ #[ inline]
415
418
pub fn skip ( & mut self , kind : Type ) -> Result < ( ) > {
416
419
self . inner . skip ( kind)
417
420
}
418
421
419
422
/// Reads the given kind of field.
423
+ #[ inline]
420
424
pub fn read < U , E > ( & mut self , kind : Type ) -> Result < U >
421
425
where
422
426
U : FromBytes < Error = E > ,
@@ -425,6 +429,7 @@ impl IterDefault<'_> {
425
429
self . inner . read ( kind)
426
430
}
427
431
432
+ #[ inline]
428
433
fn read_some < U , E > ( & mut self , kind : Type ) -> Result < Option < U > >
429
434
where
430
435
U : FromBytes < Error = E > ,
@@ -493,13 +498,13 @@ pub fn parse(capture: &[u8]) -> Result<Header> {
493
498
impl Header {
494
499
/// Returns the version of the radiotap header.
495
500
#[ inline]
496
- pub fn version ( & self ) -> u8 {
501
+ pub const fn version ( & self ) -> u8 {
497
502
VERSION
498
503
}
499
504
500
505
/// Returns the length of the entire radiotap header.
501
506
#[ inline]
502
- pub fn length ( & self ) -> usize {
507
+ pub const fn length ( & self ) -> usize {
503
508
self . length
504
509
}
505
510
}
0 commit comments