Skip to main content

openthread/ot/types/
steering_data.rs

1// Copyright 2026 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use crate::prelude_internal::*;
6
7/// Represents the steering data.
8/// Functional equivalent of [`otsys::otSteeringData`](crate::otsys::otSteeringData).
9#[derive(Debug, Default, Clone)]
10#[repr(transparent)]
11pub struct SteeringData(pub otSteeringData);
12
13impl_ot_castable!(SteeringData, otSteeringData);
14
15impl SteeringData {
16    /// Returns the length of steering data (bytes).
17    pub fn length(&self) -> u8 {
18        self.0.mLength
19    }
20
21    /// Returns the byte values of the steering data.
22    pub fn into_array(&self) -> [u8; 16] {
23        self.0.m8
24    }
25
26    /// Returns the Steering Data as a byte slice.
27    pub fn as_slice(&self) -> &[u8] {
28        &self.0.m8
29    }
30
31    /// Creates a `Vec<u8>` from this Steering Data.
32    pub fn to_vec(&self) -> Vec<u8> {
33        self.as_slice().to_vec()
34    }
35}