host.rs (1133B)
1 //! Target-aware ownership of signer and progress callback state. 2 3 /// Native signer hosts are thread safe; browser hosts may retain local state. 4 #[cfg(not(target_arch = "wasm32"))] 5 pub trait HostBound: Send + Sync {} 6 #[cfg(not(target_arch = "wasm32"))] 7 impl<T: Send + Sync + ?Sized> HostBound for T {} 8 /// Native signer hosts are thread safe; browser hosts may retain local state. 9 #[cfg(target_arch = "wasm32")] 10 pub trait HostBound {} 11 #[cfg(target_arch = "wasm32")] 12 impl<T: ?Sized> HostBound for T {} 13 14 /// Shared signer/callback ownership on its qualified host. 15 #[cfg(all(not(target_arch = "wasm32"), not(feature = "std")))] 16 pub type Shared<T> = alloc::sync::Arc<T>; 17 /// Shared signer/callback ownership on its qualified host. 18 #[cfg(all(not(target_arch = "wasm32"), feature = "std"))] 19 pub type Shared<T> = std::sync::Arc<T>; 20 /// Shared signer/callback ownership on its qualified host. 21 #[cfg(all(target_arch = "wasm32", not(feature = "std")))] 22 pub type Shared<T> = alloc::rc::Rc<T>; 23 /// Shared signer/callback ownership on its qualified host. 24 #[cfg(all(target_arch = "wasm32", feature = "std"))] 25 pub type Shared<T> = std::rc::Rc<T>;