1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use std::ops::{Deref, DerefMut};
use futures::stream::BoxStream;
use libp2p::{PeerId, kad::Record};
pub struct ProviderStream(pub BoxStream<'static, PeerId>);
impl Deref for ProviderStream {
type Target = BoxStream<'static, PeerId>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl DerefMut for ProviderStream {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl core::fmt::Debug for ProviderStream {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
writeln!(f, "ProviderStream")
}
}
pub struct RecordStream(pub BoxStream<'static, Record>);
impl Deref for RecordStream {
type Target = BoxStream<'static, Record>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl DerefMut for RecordStream {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl core::fmt::Debug for RecordStream {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
writeln!(f, "RecordStream")
}
}