sandbox/fidl/
mod.rs

1// Copyright 2024 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
5mod capability;
6mod connector;
7mod connector_router;
8mod data;
9mod data_router;
10pub(crate) mod dict;
11mod dictionary_router;
12mod dir_connector;
13mod dir_connector_router;
14mod dir_entry;
15mod dir_entry_router;
16mod directory;
17mod handle;
18mod instance_token;
19pub(crate) mod receiver;
20pub(crate) mod registry;
21pub(crate) mod router;
22pub(crate) mod store;
23mod unit;
24
25use crate::ConversionError;
26use fidl_fuchsia_component_sandbox as fsandbox;
27use std::sync::Arc;
28use vfs::directory::entry::DirectoryEntry;
29use vfs::execution_scope::ExecutionScope;
30
31/// The trait which remotes Capabilities, either by turning them into
32/// FIDL or serving them in a VFS.
33pub trait RemotableCapability: Into<fsandbox::Capability> {
34    /// Attempt to convert `self` to a DirectoryEntry which can be served in a
35    /// VFS.
36    ///
37    /// The default implementation always returns an error.
38    fn try_into_directory_entry(
39        self,
40        _scope: ExecutionScope,
41    ) -> Result<Arc<dyn DirectoryEntry>, ConversionError> {
42        Err(ConversionError::NotSupported)
43    }
44}