fidl_next_bind/
fuchsia.rs

1// Copyright 2025 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
5//! Fuchsia-specific FIDL bindings.
6
7use zx::Channel;
8
9use crate::{ClientEnd, ServerEnd};
10#[cfg(feature = "fasync")]
11use crate::{HasExecutor, RunsTransport, fuchsia_async::FuchsiaAsync};
12
13/// Creates a `ClientEnd` and `ServerEnd` for the given protocol over Zircon channels.
14pub fn create_channel<P>() -> (ClientEnd<P, zx::Channel>, ServerEnd<P, zx::Channel>) {
15    let (client_end, server_end) = Channel::create();
16    (ClientEnd::from_untyped(client_end), ServerEnd::from_untyped(server_end))
17}
18
19#[cfg(feature = "fasync")]
20impl RunsTransport<Channel> for FuchsiaAsync {}
21
22#[cfg(feature = "fasync")]
23impl HasExecutor for Channel {
24    type Executor = FuchsiaAsync;
25
26    fn executor(&self) -> Self::Executor {
27        FuchsiaAsync
28    }
29}