Skip to content

Commit 9a8b227

Browse files
committed
update RPC examples to use buffered IO
1 parent 453d58a commit 9a8b227

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

capnp-rpc/examples/calculator/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ async fn try_main(args: Vec<String>) -> Result<(), Box<dyn std::error::Error>> {
6767
let (reader, writer) = tokio_util::compat::TokioAsyncReadCompatExt::compat(stream).split();
6868

6969
let network = Box::new(twoparty::VatNetwork::new(
70-
reader,
71-
writer,
70+
futures::io::BufReader::new(reader),
71+
futures::io::BufWriter::new(writer),
7272
rpc_twoparty_capnp::Side::Client,
7373
Default::default(),
7474
));

capnp-rpc/examples/calculator/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
225225
let (reader, writer) =
226226
tokio_util::compat::TokioAsyncReadCompatExt::compat(stream).split();
227227
let network = twoparty::VatNetwork::new(
228-
reader,
229-
writer,
228+
futures::io::BufReader::new(reader),
229+
futures::io::BufWriter::new(writer),
230230
rpc_twoparty_capnp::Side::Server,
231231
Default::default(),
232232
);

capnp-rpc/examples/hello-world/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
4646
let (reader, writer) =
4747
tokio_util::compat::TokioAsyncReadCompatExt::compat(stream).split();
4848
let rpc_network = Box::new(twoparty::VatNetwork::new(
49-
reader,
50-
writer,
49+
futures::io::BufReader::new(reader),
50+
futures::io::BufWriter::new(writer),
5151
rpc_twoparty_capnp::Side::Client,
5252
Default::default(),
5353
));

capnp-rpc/examples/hello-world/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
6767
let (reader, writer) =
6868
tokio_util::compat::TokioAsyncReadCompatExt::compat(stream).split();
6969
let network = twoparty::VatNetwork::new(
70-
reader,
71-
writer,
70+
futures::io::BufReader::new(reader),
71+
futures::io::BufWriter::new(writer),
7272
rpc_twoparty_capnp::Side::Server,
7373
Default::default(),
7474
);

capnp-rpc/examples/pubsub/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
6161
let (reader, writer) =
6262
tokio_util::compat::TokioAsyncReadCompatExt::compat(stream).split();
6363
let rpc_network = Box::new(twoparty::VatNetwork::new(
64-
reader,
65-
writer,
64+
futures::io::BufReader::new(reader),
65+
futures::io::BufWriter::new(writer),
6666
rpc_twoparty_capnp::Side::Client,
6767
Default::default(),
6868
));

capnp-rpc/examples/pubsub/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
138138
let (reader, writer) =
139139
tokio_util::compat::TokioAsyncReadCompatExt::compat(stream).split();
140140
let network = twoparty::VatNetwork::new(
141-
reader,
142-
writer,
141+
futures::io::BufReader::new(reader),
142+
futures::io::BufWriter::new(writer),
143143
rpc_twoparty_capnp::Side::Server,
144144
Default::default(),
145145
);

0 commit comments

Comments
 (0)