libp2p/builder/phase/
provider.rs

1#[allow(unused_imports)]
2use super::*;
3
4use crate::SwarmBuilder;
5
6pub struct ProviderPhase {}
7
8impl SwarmBuilder<NoProviderSpecified, ProviderPhase> {
9    #[cfg(all(not(target_arch = "wasm32"), feature = "async-std"))]
10    pub fn with_async_std(self) -> SwarmBuilder<AsyncStd, TcpPhase> {
11        SwarmBuilder {
12            keypair: self.keypair,
13            phantom: std::marker::PhantomData,
14            phase: TcpPhase {},
15        }
16    }
17
18    #[cfg(all(not(target_arch = "wasm32"), feature = "tokio"))]
19    pub fn with_tokio(self) -> SwarmBuilder<Tokio, TcpPhase> {
20        SwarmBuilder {
21            keypair: self.keypair,
22            phantom: std::marker::PhantomData,
23            phase: TcpPhase {},
24        }
25    }
26
27    #[cfg(feature = "wasm-bindgen")]
28    pub fn with_wasm_bindgen(self) -> SwarmBuilder<WasmBindgen, TcpPhase> {
29        SwarmBuilder {
30            keypair: self.keypair,
31            phantom: std::marker::PhantomData,
32            phase: TcpPhase {},
33        }
34    }
35}
36
37pub enum NoProviderSpecified {}
38
39#[cfg(all(not(target_arch = "wasm32"), feature = "async-std"))]
40pub enum AsyncStd {}
41
42#[cfg(all(not(target_arch = "wasm32"), feature = "tokio"))]
43pub enum Tokio {}
44
45#[cfg(feature = "wasm-bindgen")]
46pub enum WasmBindgen {}