runtime_capabilities/
instance_token.rs1use std::any::Any;
6use std::fmt::Debug;
7use std::sync::Arc;
8
9pub trait WeakInstanceTokenAny: Debug + Send + Sync {
11 fn as_any(&self) -> &dyn Any;
12}
13
14#[derive(Debug)]
18pub struct WeakInstanceToken {
19 pub inner: Box<dyn WeakInstanceTokenAny>,
20}
21
22impl WeakInstanceToken {
23 pub fn new_invalid() -> Arc<Self> {
26 #[derive(Debug)]
27 struct Nothing;
28 impl WeakInstanceTokenAny for Nothing {
29 fn as_any(&self) -> &dyn Any {
30 self
31 }
32 }
33 Arc::new(Self { inner: Box::new(Nothing {}) })
34 }
35
36 #[cfg(target_os = "fuchsia")]
37 pub fn try_into_directory_entry(
38 self: Arc<Self>,
39 _scope: vfs::execution_scope::ExecutionScope,
40 _token: Arc<crate::WeakInstanceToken>,
41 ) -> Result<Arc<dyn vfs::directory::entry::DirectoryEntry>, crate::ConversionError> {
42 Err(crate::ConversionError::NotSupported)
43 }
44}