sandbox/
instance_token.rs1use fidl_fuchsia_component_sandbox as fsandbox;
6use std::any::Any;
7use std::fmt::Debug;
8use std::sync::Arc;
9
10pub trait WeakInstanceTokenAny: Debug + Send + Sync {
12 fn as_any(&self) -> &dyn Any;
13}
14
15#[derive(Clone, Debug)]
19pub struct WeakInstanceToken {
20 pub inner: Arc<dyn WeakInstanceTokenAny>,
21}
22
23impl From<WeakInstanceToken> for fsandbox::Capability {
24 fn from(_component: WeakInstanceToken) -> Self {
25 todo!("b/337284929: Decide on if InstanceToken should be in Capability");
26 }
27}
28
29impl WeakInstanceToken {
30 pub fn new_invalid() -> Self {
33 #[derive(Debug)]
34 struct Nothing;
35 impl WeakInstanceTokenAny for Nothing {
36 fn as_any(&self) -> &dyn Any {
37 self
38 }
39 }
40 Self { inner: Arc::new(Nothing {}) }
41 }
42}