script_webcrypto/
traits.rs1use script_bindings::DomTypes;
6#[cfg(feature = "subtlecrypto")]
7use script_bindings::reflector::DomObject;
8#[cfg(feature = "subtlecrypto")]
9use script_bindings::tasks::TaskOnce;
10
11use crate::crypto::Crypto;
12#[cfg(feature = "subtlecrypto")]
13use crate::cryptokey::CryptoKey;
14#[cfg(feature = "subtlecrypto")]
15use crate::subtlecrypto::SubtleCrypto;
16
17#[cfg(feature = "subtlecrypto")]
19trait_set::trait_set! {
20 pub trait Equivalence = DomTypes<
21 Crypto = Crypto<Self>,
22 CryptoKey = CryptoKey<Self>,
23 SubtleCrypto = SubtleCrypto<Self>,
24 GlobalScope: WebCryptoGlobalTrait<Self>>;
26}
27
28#[cfg(not(feature = "subtlecrypto"))]
29trait_set::trait_set! {
30 pub trait Equivalence = DomTypes<Crypto = Crypto<Self>>;
31}
32
33#[cfg(feature = "subtlecrypto")]
34pub trait WebCryptoGlobalTrait<D: DomTypes>: Sized + DomObject {
35 fn queue_crypto_task_source(&self, task: impl TaskOnce + 'static);
36 fn queue_dom_manipulation_task_source(&self, task: impl TaskOnce + 'static);
37}