1// Copyright 2018 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.
45/// Macro to help build bluetooth fidl statuses.
6/// No Args is a success
7/// One Arg is the error type
8/// Two Args is the error type & a description
9#[macro_export]
10macro_rules! bt_fidl_status {
11 () => {
12 fidl_fuchsia_bluetooth::Status { error: None }
13 };
1415 ($error_code:ident) => {
16 fidl_fuchsia_bluetooth::Status {
17 error: Some(Box::new(fidl_fuchsia_bluetooth::Error {
18 description: None,
19 protocol_error_code: 0,
20 error_code: fidl_fuchsia_bluetooth::ErrorCode::$error_code,
21 })),
22 }
23 };
2425 ($error_code:ident, $description:expr) => {
26 fidl_fuchsia_bluetooth::Status {
27 error: Some(Box::new(fidl_fuchsia_bluetooth::Error {
28 description: Some($description.to_string()),
29 protocol_error_code: 0,
30 error_code: fidl_fuchsia_bluetooth::ErrorCode::$error_code,
31 })),
32 }
33 };
34}