Skip to content

Commit 5936fa1

Browse files
Merge pull request #13 from kate-goldenring/update-extensibility
Update extensibility with newer dependencies changes
2 parents debc1bd + bf80612 commit 5936fa1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

docs/development/development-walkthrough.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ A `DiscoveryHandlerImpl` Struct has been created (in `discovery_handler.rs`) tha
6666
First, let's add the additional crates we are using to our `Cargo.toml` under dependencies.
6767

6868
```text
69+
tokio-stream = { version = "0.1", features = ["net"] }
6970
anyhow = "1.0.38"
7071
reqwest = "0.10.8"
72+
env_logger = "0.9.0"
73+
log = "0.4"
7174
```
7275

7376
Now, import our dependencies and define some constants. Add the following after the other imports at the top of `discovery_handler.rs`.
@@ -94,8 +97,8 @@ impl DiscoveryHandler for DiscoveryHandlerImpl {
9497
// Get the discovery url from the `DiscoverRequest`
9598
let url = request.get_ref().discovery_details.clone();
9699
// Create a channel for sending and receiving device updates
97-
let (mut stream_sender, stream_receiver) = mpsc::channel(4);
98-
let mut register_sender = self.register_sender.clone();
100+
let (stream_sender, stream_receiver) = mpsc::channel(4);
101+
let register_sender = self.register_sender.clone();
99102
tokio::spawn(async move {
100103
loop {
101104
let resp = get(&url).await.unwrap();
@@ -124,7 +127,9 @@ impl DiscoveryHandler for DiscoveryHandlerImpl {
124127
}
125128
});
126129
// Send the agent one end of the channel to receive device updates
127-
Ok(Response::new(stream_receiver))
130+
Ok(Response::new(tokio_stream::wrappers::ReceiverStream::new(
131+
stream_receiver,
132+
)))
128133
}
129134
}
130135
```

0 commit comments

Comments
 (0)