3
3
#![ cfg_attr( feature = "nightly" , feature( external_doc) ) ]
4
4
#![ cfg_attr( feature = "nightly" , doc( include = "../README.md" ) ) ]
5
5
6
- #[ macro_use]
7
- extern crate tracing;
8
-
9
- pub use crate :: ipld:: Ipld ;
10
- use anyhow:: { anyhow, format_err} ;
11
- pub use bitswap:: { BitswapEvent , Block , Stats } ;
12
- pub use cid:: Cid ;
13
- use cid:: Codec ;
14
- use either:: Either ;
15
- use futures:: channel:: mpsc:: { channel, Receiver , Sender } ;
16
- use futures:: channel:: oneshot:: { channel as oneshot_channel, Sender as OneshotSender } ;
17
- use futures:: sink:: SinkExt ;
18
- use futures:: stream:: { Fuse , Stream } ;
19
- pub use libp2p:: core:: {
20
- connection:: ListenerId , multiaddr:: Protocol , ConnectedPoint , Multiaddr , PeerId , PublicKey ,
21
- } ;
22
- use libp2p:: swarm:: NetworkBehaviour ;
23
- pub use libp2p:: {
24
- identity:: Keypair ,
25
- kad:: { record:: Key , Quorum } ,
26
- } ;
27
- use std:: path:: PathBuf ;
28
- use tracing:: Span ;
29
- use tracing_futures:: Instrument ;
30
-
31
- use std:: borrow:: Borrow ;
32
- use std:: collections:: { HashMap , HashSet } ;
33
- use std:: fmt;
34
- use std:: future:: Future ;
35
- use std:: ops:: Range ;
36
- use std:: pin:: Pin ;
37
- use std:: sync:: { atomic:: Ordering , Arc } ;
38
- use std:: task:: { Context , Poll } ;
39
-
40
6
mod config;
41
7
pub mod dag;
42
8
pub mod error;
@@ -50,17 +16,66 @@ pub mod repo;
50
16
mod subscription;
51
17
pub mod unixfs;
52
18
53
- use self :: dag:: IpldDag ;
54
- pub use self :: error:: Error ;
55
- use self :: ipns:: Ipns ;
56
- use self :: p2p:: addr:: { could_be_bound_from_ephemeral, starts_unspecified} ;
57
- pub use self :: p2p:: pubsub:: { PubsubMessage , SubscriptionStream } ;
58
- use self :: p2p:: { create_swarm, SwarmOptions , TSwarm } ;
59
- pub use self :: p2p:: { Connection , KadResult , MultiaddrWithPeerId , MultiaddrWithoutPeerId } ;
60
- pub use self :: path:: IpfsPath ;
61
- use self :: repo:: { create_repo, Repo , RepoEvent , RepoOptions } ;
62
- pub use self :: repo:: { PinKind , PinMode , RepoTypes } ;
63
- use self :: subscription:: SubscriptionFuture ;
19
+ #[ macro_use]
20
+ extern crate tracing;
21
+
22
+ use anyhow:: { anyhow, format_err} ;
23
+ use cid:: Codec ;
24
+ use either:: Either ;
25
+ use futures:: {
26
+ channel:: {
27
+ mpsc:: { channel, Receiver , Sender } ,
28
+ oneshot:: { channel as oneshot_channel, Sender as OneshotSender } ,
29
+ } ,
30
+ sink:: SinkExt ,
31
+ stream:: { Fuse , Stream } ,
32
+ } ;
33
+ use libp2p:: swarm:: NetworkBehaviour ;
34
+ use tracing:: Span ;
35
+ use tracing_futures:: Instrument ;
36
+
37
+ use std:: {
38
+ borrow:: Borrow ,
39
+ collections:: { HashMap , HashSet } ,
40
+ env, fmt,
41
+ future:: Future ,
42
+ ops:: { Deref , DerefMut , Range } ,
43
+ path:: PathBuf ,
44
+ pin:: Pin ,
45
+ sync:: { atomic:: Ordering , Arc } ,
46
+ task:: { Context , Poll } ,
47
+ } ;
48
+
49
+ use self :: {
50
+ dag:: IpldDag ,
51
+ ipns:: Ipns ,
52
+ p2p:: {
53
+ addr:: { could_be_bound_from_ephemeral, starts_unspecified} ,
54
+ create_swarm, SwarmOptions , TSwarm ,
55
+ } ,
56
+ repo:: { create_repo, Repo , RepoEvent , RepoOptions } ,
57
+ subscription:: SubscriptionFuture ,
58
+ } ;
59
+
60
+ pub use self :: {
61
+ error:: Error ,
62
+ ipld:: Ipld ,
63
+ p2p:: {
64
+ pubsub:: { PubsubMessage , SubscriptionStream } ,
65
+ Connection , KadResult , MultiaddrWithPeerId , MultiaddrWithoutPeerId ,
66
+ } ,
67
+ path:: IpfsPath ,
68
+ repo:: { PinKind , PinMode , RepoTypes } ,
69
+ } ;
70
+ pub use bitswap:: { BitswapEvent , Block , Stats } ;
71
+ pub use cid:: Cid ;
72
+ pub use libp2p:: {
73
+ core:: {
74
+ connection:: ListenerId , multiaddr:: Protocol , ConnectedPoint , Multiaddr , PeerId , PublicKey ,
75
+ } ,
76
+ identity:: Keypair ,
77
+ kad:: { record:: Key , Quorum } ,
78
+ } ;
64
79
65
80
/// All types can be changed at compile time by implementing
66
81
/// `IpfsTypes`.
@@ -119,7 +134,7 @@ impl IpfsOptions {
119
134
/// Creates an inmemory store backed node for tests
120
135
pub fn inmemory_with_generated_keys ( ) -> Self {
121
136
Self {
122
- ipfs_path : std :: env:: temp_dir ( ) ,
137
+ ipfs_path : env:: temp_dir ( ) ,
123
138
keypair : Keypair :: generate_ed25519 ( ) ,
124
139
mdns : Default :: default ( ) ,
125
140
bootstrap : Default :: default ( ) ,
@@ -194,13 +209,13 @@ impl Default for IpfsOptions {
194
209
) ;
195
210
}
196
211
197
- let ipfs_path = if let Ok ( path) = std :: env:: var ( "IPFS_PATH" ) {
212
+ let ipfs_path = if let Ok ( path) = env:: var ( "IPFS_PATH" ) {
198
213
PathBuf :: from ( path)
199
214
} else {
200
215
let root = if let Some ( home) = dirs:: home_dir ( ) {
201
216
home
202
217
} else {
203
- std :: env:: current_dir ( ) . unwrap ( )
218
+ env:: current_dir ( ) . unwrap ( )
204
219
} ;
205
220
root. join ( ".rust-ipfs" )
206
221
} ;
@@ -383,7 +398,7 @@ impl<Types: IpfsTypes> UninitializedIpfs<Types> {
383
398
}
384
399
}
385
400
386
- impl < Types : IpfsTypes > std :: ops :: Deref for Ipfs < Types > {
401
+ impl < Types : IpfsTypes > Deref for Ipfs < Types > {
387
402
type Target = IpfsInner < Types > ;
388
403
389
404
fn deref ( & self ) -> & Self :: Target {
@@ -1676,16 +1691,16 @@ mod node {
1676
1691
}
1677
1692
}
1678
1693
1679
- impl std :: ops :: Deref for Node {
1694
+ impl Deref for Node {
1680
1695
type Target = Ipfs < TestTypes > ;
1681
1696
1682
1697
fn deref ( & self ) -> & Self :: Target {
1683
1698
& self . ipfs
1684
1699
}
1685
1700
}
1686
1701
1687
- impl std :: ops :: DerefMut for Node {
1688
- fn deref_mut ( & mut self ) -> & mut <Self as std :: ops :: Deref >:: Target {
1702
+ impl DerefMut for Node {
1703
+ fn deref_mut ( & mut self ) -> & mut <Self as Deref >:: Target {
1689
1704
& mut self . ipfs
1690
1705
}
1691
1706
}
0 commit comments