wlan_common/mac/mgmt/
reason.rs

1// Copyright 2019 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 fidl_fuchsia_wlan_ieee80211 as fidl_ieee80211;
6use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout};
7
8#[repr(C)]
9#[derive(
10    IntoBytes, KnownLayout, FromBytes, Immutable, PartialEq, Eq, Clone, Copy, Debug, Default,
11)]
12pub struct ReasonCode(pub u16);
13
14impl From<fidl_ieee80211::ReasonCode> for ReasonCode {
15    fn from(fidl_reason_code: fidl_ieee80211::ReasonCode) -> ReasonCode {
16        ReasonCode(fidl_reason_code.into_primitive())
17    }
18}
19
20impl From<ReasonCode> for Option<fidl_ieee80211::ReasonCode> {
21    fn from(reason_code: ReasonCode) -> Option<fidl_ieee80211::ReasonCode> {
22        fidl_ieee80211::ReasonCode::from_primitive(reason_code.0)
23    }
24}