openthread/ot/types/
packets_and_bytes.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2022 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

use crate::prelude_internal::*;

/// This structure represents counters for packets and bytes.
///
/// Functional equivalent of [`otsys::otPacketsAndBytes`](crate::otsys::otPacketsAndBytes).
#[derive(Debug, Default, Clone)]
#[repr(transparent)]
pub struct PacketsAndBytes(pub otPacketsAndBytes);

impl_ot_castable!(PacketsAndBytes, otPacketsAndBytes);

impl PacketsAndBytes {
    /// The number of packets.
    pub fn packets(&self) -> u64 {
        self.0.mPackets
    }

    /// The number of bytes.
    pub fn bytes(&self) -> u64 {
        self.0.mBytes
    }
}