Wio Terminal how to use `writeln` method in UART - rust

I use wio_terminal crate and implement UART communication.Previously following code could build but now it couldn't.
Now I use current version 0.6.1, previously I used version 0.3
#![no_std]
#![no_main]
use panic_halt as _;
use wio_terminal as wio;
use core::fmt::Write;
use wio::hal::clock::GenericClockController;
use wio::pac::Peripherals;
use wio::prelude::*;
use wio::{entry, Pins, Sets};
#[entry]
fn main() -> ! {
let mut peripherals = Peripherals::take().unwrap();
// Init clock
let mut clocks = GenericClockController::with_external_32kosc(
peripherals.GCLK,
&mut peripherals.MCLK,
&mut peripherals.OSC32KCTRL,
&mut peripherals.OSCCTRL,
&mut peripherals.NVMCTRL,
);
// Init UART driver
let mut sets: Sets = Pins::new(peripherals.PORT).split();
let mut serial = sets.uart.init(
&mut clocks,
115200.hz(),
peripherals.SERCOM2,
&mut peripherals.MCLK,
);
// Transfer UART
writeln!(&mut serial, "this is {} example!", "UART").unwrap();
}
Partly editted, so the line of error is different
This is the error message.
error[E0599]: the method `write_fmt` exists for mutable reference `&mut wio_terminal::atsamd_hal::sercom::uart::Uart<wio_terminal::atsamd_hal::sercom::uart::Config<wio_terminal::atsamd_hal::sercom::uart::Pads<SERCOM2, IoSet2, wio_terminal::atsamd_hal::gpio::Pin<PB27, wio_terminal::atsamd_hal::gpio::Alternate<wio_terminal::atsamd_hal::gpio::C>>, wio_terminal::atsamd_hal::gpio::Pin<PB26, wio_terminal::atsamd_hal::gpio::Alternate<wio_terminal::atsamd_hal::gpio::C>>>>, wio_terminal::atsamd_hal::sercom::uart::Duplex>`, but its trait bounds were not satisfied
--> examples\6-3-uart.rs:54:5
|
54 | writeln!(&mut serial, "this is {} example!", "UART").unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
::: C:\Users\\.cargo\registry\src\github.com-1ecc6299db9ec823\atsamd-hal-0.15.1\src\sercom\uart.rs:602:1
|
602 | / pub struct Uart<C, D>
603 | | where
604 | | C: ValidConfig,
605 | | D: Capability,
... |
608 | | capability: PhantomData<D>,
609 | | }
| |_- doesn't satisfy `_: core::fmt::Write`
|
= note: the following trait bounds were not satisfied:
`wio_terminal::atsamd_hal::sercom::uart::Uart<wio_terminal::atsamd_hal::sercom::uart::Config<wio_terminal::atsamd_hal::sercom::uart::Pads<SERCOM2, IoSet2, wio_terminal::atsamd_hal::gpio::Pin<PB27, wio_terminal::atsamd_hal::gpio::Alternate<wio_terminal::atsamd_hal::gpio::C>>, wio_terminal::atsamd_hal::gpio::Pin<PB26, wio_terminal::atsamd_hal::gpio::Alternate<wio_terminal::atsamd_hal::gpio::C>>>>, wio_terminal::atsamd_hal::sercom::uart::Duplex>: core::fmt::Write`
which is required by `&mut wio_terminal::atsamd_hal::sercom::uart::Uart<wio_terminal::atsamd_hal::sercom::uart::Config<wio_terminal::atsamd_hal::sercom::uart::Pads<SERCOM2, IoSet2, wio_terminal::atsamd_hal::gpio::Pin<PB27, wio_terminal::atsamd_hal::gpio::Alternate<wio_terminal::atsamd_hal::gpio::C>>, wio_terminal::atsamd_hal::gpio::Pin<PB26, wio_terminal::atsamd_hal::gpio::Alternate<wio_terminal::atsamd_hal::gpio::C>>>>, wio_terminal::atsamd_hal::sercom::uart::Duplex>: core::fmt::Write`
= note: this error originates in the macro `writeln` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unused import: `core::fmt::Write`
--> uart.rs:20:5
|
20 | use core::fmt::Write;
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
For more information about this error, try `rustc --explain E0599`.
warning: `sample-template` (example "6-3-uart") generated 1 warning
error: could not compile `sample-template` due to previous error; 1 warning emitted
I couldn't understand and resolve this error. Please let me know how to resolve it.

Related

Wrap a hyper::Body in a BufReader in Rust

I have a hyper::Body and I want to wrap it in a BufReader (for example tokio::io::BufReader, but futures_util::io::BufReader or any other is fine too).
Using it directly didn't work:
fn foo(body: hyper::Body) {
let bufreader = tokio::io::BufReader::new(body);
}
error[E0277]: the trait bound `Body: AsyncRead` is not satisfied
--> src/lib.rs:2:47
|
2 | let bufreader = tokio::io::BufReader::new(body);
| ------------------------- ^^^^ the trait `AsyncRead` is not implemented for `Body`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `AsyncRead`:
&[u8]
&mut T
AddrStream
Box<T>
BufStream<RW>
DuplexStream
Pin<P>
Upgraded
and 20 others
note: required by a bound in `tokio::io::BufReader::<R>::new`
--> /playground/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.23.0/src/io/util/buf_reader.rs:37:9
|
37 | impl<R: AsyncRead> BufReader<R> {
| ^^^^^^^^^ required by this bound in `tokio::io::BufReader::<R>::new`
For more information about this error, try `rustc --explain E0277`.
error: could not compile `playground` due to previous error
I'm aware there are multiple AsyncRead in rust, tokio_util::compat::* and futures_util::compat::* can be used to convert between them, but it seems hyper::Body doesn't implement either of them.
It implements futures_core::stream::Stream but I don't know how to feed this into a BufReader.

mutate rust value between threads with crossbeam

I am modifiying a crate (rust-argon2) to some custom needs. That crate uses multithreading with scoped threads using crossbeam. I want to have a mutable state between threads, that may depend on each other.
The following snippet showcases the situation: fill_memory_blocks_mt gets some mutable state reference state, that will be mutated in fill_segment across multiple threads using crossbeam_utils::thread::scope. They are synced via common::SYNC_POINTS.
fn fill_memory_blocks_mt(context: &Context, memory: &mut Memory, state: &mut Argon2Result) {
for p in 0..context.config.time_cost {
for s in 0..common::SYNC_POINTS {
let _ = scope(|scoped| {
for (l, mem) in (0..context.config.lanes).zip(memory.as_lanes_mut()) {
let position = Position {
pass: p,
lane: l,
slice: s,
index: 0,
};
scoped.spawn(move |_| {
fill_segment(context, &position, mem, state);
});
}
});
}
}
}
The compiler outputs following message:
error[E0382]: use of moved value: `state`
--> src/core.rs:223:34
|
223 | scoped.spawn(move |_| {
| ^^^^^^^^ value moved into closure here, in previous iteration of loop
224 | fill_segment(context, &position, mem, state);
| ----- use occurs due to use in closure
|
= note: move occurs because `state` has type `&mut Argon2Result`, which does not implement the `Copy` trait
help: consider creating a fresh reborrow of `state` here
|
223 | scoped.spawn(&mut *move |_| {
| ++++++
error[E0382]: use of moved value: `state`
--> src/core.rs:215:27
|
212 | fn fill_memory_blocks_mt(context: &Context, memory: &mut Memory, state: &mut Argon2Result) {
| ----- move occurs because `state` has type `&mut Argon2Result`, which does not implement the `Copy` trait
...
215 | let _ = scope(|scoped| {
| ^^^^^^^^ value moved into closure here, in previous iteration of loop
...
224 | fill_segment(context, &position, mem, state);
| ----- use occurs due to use in closure
|
help: consider creating a fresh reborrow of `state` here
|
215 | let _ = scope(&mut *|scoped| {
| ++++++
For more information about this error, try `rustc --explain E0382`.
error: could not compile `rust-argon2-wasm` due to 2 previous errors
Of course I don't want to copy state but use one instance for all threads. They don't overwrite fields between each other, but may depend on each other.

Cannot determine return type for grpc stream

I am trying to implement a simple stream rpc using tonic and grpc. I have been following the routeguide tutorial.
When I try to return a tokio_stream::wrappers::ReceiverStream from my stream method I get compile error indicating I should return a Result wrapped by a ReceiverStream.
warning: unused manifest key: package.author
Compiling prng_generator v0.1.0 (/home/babbleshack/projects/prng_generator)
error[E0308]: mismatched types
--> src/bin/server.rs:51:46
|
51 | Ok(Response::new(ReceiverStream::new(rx)))
| ^^ expected enum `Result`, found struct `PrngResponse`
|
= note: expected struct `tokio::sync::mpsc::Receiver<Result<PrngResponse, Status>>`
found struct `tokio::sync::mpsc::Receiver<PrngResponse>`
note: return type inferred to be `tokio::sync::mpsc::Receiver<Result<PrngResponse, Status>>` here
--> src/bin/server.rs:41:67
|
41 | ) -> Result<Response<Self::PRNGServiceRequestStream>, Status> {
| ___________________________________________________________________^
42 | | let (mut tx, rx) = mpsc::channel(4);
43 | | let response_data = self.data.clone();
44 | |
... |
51 | | Ok(Response::new(ReceiverStream::new(rx)))
52 | | }
| |_____^
For more information about this error, try `rustc --explain E0308`.
error: could not compile `prng_generator` due to previous error
When I wrap my return channel in a Result I get a contradicting error message:
error[E0308]: mismatched types
--> src/bin/server.rs:51:46
|
51 | Ok(Response::new(ReceiverStream::new(Ok(rx))))
| ^^^^^^ expected struct `tokio::sync::mpsc::Receiver`, found enum `Result`
|
= note: expected struct `tokio::sync::mpsc::Receiver<Result<PrngResponse, Status>>`
found enum `Result<tokio::sync::mpsc::Receiver<PrngResponse>, _>`
note: return type inferred to be `tokio::sync::mpsc::Receiver<Result<PrngResponse, Status>>` here
--> src/bin/server.rs:41:67
|
41 | ) -> Result<Response<Self::PRNGServiceRequestStream>, Status> {
| ___________________________________________________________________^
42 | | let (mut tx, rx) = mpsc::channel(4);
43 | | let response_data = self.data.clone();
44 | |
... |
51 | | Ok(Response::new(ReceiverStream::new(Ok(rx))))
52 | | }
| |_____^
Here is my proto:
use std::sync::Arc;
use tokio::sync::mpsc;
use tonic::{Request, Response, Status};
use tokio_stream::wrappers::ReceiverStream;
pub mod types {
tonic::include_proto!("types");
}
use types::prng_service_server::PrngService;
use types::{PrngRequest, PrngResponse};
And the implementing rust code:
use std::sync::Arc;
use tokio::sync::mpsc;
use tonic::{Request, Response, Status};
use tokio_stream::wrappers::ReceiverStream;
pub mod types {
tonic::include_proto!("types");
}
use types::prng_service_server::PrngService;
use types::{PrngRequest, PrngResponse};
#[derive(Debug, Default)]
pub struct PRNGServiceImpl{
data: Arc<Vec<PrngResponse>>,
}
#[tonic::async_trait]
impl PrngService for PRNGServiceImpl {
type PRNGServiceRequestStream = ReceiverStream<Result<PrngResponse, Status>>;
async fn prng_service_request(
&self,
request: Request<PrngRequest>,
) -> Result<Response<Self::PRNGServiceRequestStream>, Status> {
let (mut tx, rx) = mpsc::channel(256);
let response_data = self.data.clone();
tokio::spawn(async move {
for response in &response_data[..] {
Ok(tx.send(response.clone()).await.unwrap());
}
println!(" /// done sending");
});
Ok(Response::new(ReceiverStream::new(rx)))
//Ok(Response::new(ReceverStream::new(Ok(rx))))
}
}
How do I determine what my return type should be here?
The error message indicates that your return type declares a stream that produces Result<PrngResponse, Status> values, but the stream you have given it produces PrngResponse values. Your attempt to fix the solution wraps the receiver channel in a Result, which is not the same thing.
To fix this, you need to change the type that rx is inferred to be. It's inferred to be a stream of PrngResponse because of the tx.send() call, which sends a PrngResponse, so you can fix this by sending a Result instead:
tx.send(Ok(response.clone()))
The compiler points at the returned value and not the tx.send() line because the problem is the mismatch between the declared return type of the function and what it actually returns. The compiler could probably figure out that this is due to the tx.send() invocation, but in many cases type inference uses information spread out over multiple lines and there may not be one single line responsible for the inferred type of the returned value.
One way you could trace the problem to its source is to provide an explicit type somewhere matching the return type. For example:
let (mut tx, rx) = mpsc::channel::<Result<PrngResponse, Status>>(256);
This change would resolve the return type issue, and the compiler would have then pointed at the tx.send() line indicating that the sent value is not a Result.

How to use set_source_pixbuf in rust?

I have a code where i use set_source_pixbuf,
use gdk::prelude::*;
use gdk_pixbuf::{Colorspace, Pixbuf};
use gtk::prelude::*;
use std::sync::{Arc, Mutex};
use super::prelude::*;
mod control_panel;
use control_panel::setup_control_panel;
macro_rules! clone {
(#param _) => ( _ );
(#param $x:ident) => ( $x );
($($n:ident),+ => move || $body:expr) => (
{
$( let $n = $n.clone(); )+
move || $body
}
);
($($n:ident),+ => move |$($p:tt),+| $body:expr) => (
{
$( let $n = $n.clone(); )+
move |$(clone!(#param $p),)+| $body
}
);
}
pub fn process_key(controller: &Arc<Mutex<Controller>>, drawing_area: &gtk::DrawingArea, key: u16) {
{
let mut contr = controller.lock().unwrap();
contr.process_key(key);
}
drawing_area.queue_draw();
}
pub fn build_ui(app: &gtk::Application) {
let window = gtk::ApplicationWindow::new(app);
window.set_title("Muscle");
let glade_src = "config/control_window.glade";
let builder = gtk::Builder::from_file(glade_src);
let control_window: gtk::Window = builder.get_object("window").expect("Couldn't get window");
control_window.set_application(Some(app));
control_window.set_title("Control panel");
let fixed = gtk::Fixed::new();
let drawing_area = gtk::DrawingArea::new();
fixed.add(&drawing_area);
window.add(&fixed);
drawing_area.set_size_request(constants::WIDTH as i32, constants::HEIGHT as i32);
let Config {
muscle_config: mconf,
carcass_config: cconf,
} = read_from_config();
let muscle = Arc::new(Mutex::new(Muscle::new(
mconf.radiuses,
mconf.grow_mults,
mconf.len,
)));
let carcass = Arc::new(Mutex::new(Carcass::new(
cconf.data,
cconf.thickness,
mconf.len,
)));
let pixbuf = Pixbuf::new(
Colorspace::Rgb,
constants::HAS_ALPHA,
constants::BITS_PER_COLOR,
constants::WIDTH as i32,
constants::HEIGHT as i32,
)
.unwrap();
let mut controller = Controller::new(pixbuf.clone(), muscle, carcass);
controller.update_pixbuf();
let controller = Arc::new(Mutex::new(controller));
drawing_area.connect_draw(clone!(pixbuf => move |_, context| {
context.set_source_pixbuf(&pixbuf, 0_f64, 0_f64);
context.paint();
Inhibit(false)
}));
window.connect_key_press_event(clone!(controller, drawing_area => move |_, key| {
process_key(&controller, &drawing_area, key.get_hardware_keycode());
Inhibit(false)
}));
window.show_all();
setup_control_panel(&builder, &controller, &drawing_area);
control_window.show_all();
}
when i try to build this module it gives me an error:
better0fdead#better0fdead-To-be-filled-by-O-E-M:~/Downloads/bmstu-cg-course$ cargo run --release
warning: the cargo feature `edition2021` has been stabilized in the 1.56 release and is no longer necessary to be listed in the manifest
See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature.
Compiling course_g v0.1.0 (/home/better0fdead/Downloads/bmstu-cg-course)
error[E0599]: no method named `set_source_pixbuf` found for reference `&cairo::context::Context` in the current scope
--> src/lib/ui.rs:80:17
|
80 | context.set_source_pixbuf(&pixbuf, 0_f64, 0_f64);
| ^^^^^^^^^^^^^^^^^
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
1 | use gdk::cairo_interaction::GdkContextExt;
|
help: there is an associated function with a similar name
|
80 | context.set_source_rgb(&pixbuf, 0_f64, 0_f64);
| ~~~~~~~~~~~~~~
warning: unused import: `gdk::prelude`
--> src/lib/ui.rs:1:5
|
1 | use gdk::prelude::*;
| ^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
For more information about this error, try `rustc --explain E0599`.
warning: `course_g` (bin "course_g") generated 1 warning
error: could not compile `course_g` due to previous error; 1 warning emitted
i tried adding command : use gdk::cairo_interaction::GdkContextExt; to the file , which does not help me.
better0fdead#better0fdead-To-be-filled-by-O-E-M:~/Downloads/bmstu-cg-course$ cargo run --release
warning: the cargo feature `edition2021` has been stabilized in the 1.56 release and is no longer necessary to be listed in the manifest
See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature.
Compiling course_g v0.1.0 (/home/better0fdead/Downloads/bmstu-cg-course)
error[E0603]: module `cairo_interaction` is private
--> src/lib/ui.rs:5:10
|
5 | use gdk::cairo_interaction::GdkContextExt;
| ^^^^^^^^^^^^^^^^^ private module
|
note: the module `cairo_interaction` is defined here
--> /home/better0fdead/.cargo/registry/src/github.com-1ecc6299db9ec823/gdk-0.15.2/src/lib.rs:31:1
|
31 | mod cairo_interaction;
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0599]: no method named `set_source_pixbuf` found for reference `&cairo::context::Context` in the current scope
--> src/lib/ui.rs:81:17
|
81 | context.set_source_pixbuf(&pixbuf, 0_f64, 0_f64);
| ^^^^^^^^^^^^^^^^^
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
1 | use gdk::cairo_interaction::GdkContextExt;
|
help: there is an associated function with a similar name
|
81 | context.set_source_rgb(&pixbuf, 0_f64, 0_f64);
| ~~~~~~~~~~~~~~
warning: unused import: `gdk::prelude`
--> src/lib/ui.rs:1:5
|
1 | use gdk::prelude::*;
| ^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
Some errors have detailed explanations: E0599, E0603.
For more information about an error, try `rustc --explain E0599`.
warning: `course_g` (bin "course_g") generated 1 warning
error: could not compile `course_g` due to 2 previous errors; 1 warning emitted
use gdk::prelude::GdkContextExt;
does not work aswell
better0fdead#better0fdead-To-be-filled-by-O-E-M:~/Downloads/bmstu-cg-course$ cargo run --release
warning: the cargo feature `edition2021` has been stabilized in the 1.56 release and is no longer necessary to be listed in the manifest
See https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-edition-field for more information about using this feature.
Compiling course_g v0.1.0 (/home/better0fdead/Downloads/bmstu-cg-course)
error[E0599]: no method named `set_source_pixbuf` found for reference `&cairo::context::Context` in the current scope
--> src/lib/ui.rs:80:17
|
80 | context.set_source_pixbuf(&pixbuf, 0_f64, 0_f64);
| ^^^^^^^^^^^^^^^^^
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
1 | use gdk::cairo_interaction::GdkContextExt;
|
help: there is an associated function with a similar name
|
80 | context.set_source_rgb(&pixbuf, 0_f64, 0_f64);
| ~~~~~~~~~~~~~~
warning: unused import: `gdk::prelude`
--> src/lib/ui.rs:1:5
|
1 | use gdk::prelude::*;
| ^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused import: `gdk::prelude::GdkContextExt`
--> src/lib/ui.rs:5:5
|
5 | use gdk::prelude::GdkContextExt;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0599`.
warning: `course_g` (bin "course_g") generated 2 warnings
error: could not compile `course_g` due to previous error; 2 warnings emitted
As the error message says, gdt::cairo_interaction is a private module, so we can't use it.
The documentation says GdkContentExt is exposed in the gdk::prelude module. So importing it from the module solves the problem.
use gdk::prelude::GdkContentExt;

Cannot compile: using try_buffer_unordered with StreamExt map

I'm trying to use StreamExt and TryStreamExt as follows:
use tokio::fs::File;
use tokio::io::{self, AsyncReadExt};
use futures::stream::{self, StreamExt, TryStreamExt};
async fn read_file(name: &str) -> io::Result<[u8; 10]> {
let mut f = File::open(name).await?;
let mut buffer = [0; 10];
// read up to 10 bytes... yes I know this is not safe but...
let n = f.read(&mut buffer[..]).await?;
Ok(buffer)
}
#[tokio::main]
async fn main() -> io::Result<()> {
let files = vec!["foo.txt", "bar.txt"];
let headers = stream::iter(files)
.map(|f| {
tokio::spawn(
read_file(f)
)
})
.try_buffer_unordered(8)
.try_collect()?;
println!("Got results: {:?}", headers);
Ok(())
}
A link to the playground is here:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=3edf39926c3f046f89f2d925f1a93115
The result of the async_fn and the tokio::spawn is a Result<Result<...., MyError>, JoinError>. The try_buffer_unordered does not compile after a map, which I cannot figure out. I get:
Compiling playground v0.0.1 (/playground)
error[E0599]: no method named `try_buffer_unordered` found for struct `futures::stream::Map<futures::stream::Iter<std::vec::IntoIter<&str>>, [closure#src/main.rs:19:14: 23:10]>` in the current scope
--> src/main.rs:24:10
|
24 | .try_buffer_unordered(8)
| ^^^^^^^^^^^^^^^^^^^^ method not found in `futures::stream::Map<futures::stream::Iter<std::vec::IntoIter<&str>>, [closure#src/main.rs:19:14: 23:10]>`
|
::: /playground/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.13/src/stream/stream/map.rs:12:1
|
12 | / pin_project! {
13 | | /// Stream for the [`map`](super::StreamExt::map) method.
14 | | #[must_use = "streams do nothing unless polled"]
15 | | pub struct Map<St, F> {
... |
19 | | }
20 | | }
| | -
| | |
| |_doesn't satisfy `_: TryStreamExt`
| doesn't satisfy `_: TryStream`
|
= note: the method `try_buffer_unordered` exists but the following trait bounds were not satisfied:
`futures::stream::Map<futures::stream::Iter<std::vec::IntoIter<&str>>, [closure#src/main.rs:19:14: 23:10]>: TryStream`
which is required by `futures::stream::Map<futures::stream::Iter<std::vec::IntoIter<&str>>, [closure#src/main.rs:19:14: 23:10]>: TryStreamExt`
`&futures::stream::Map<futures::stream::Iter<std::vec::IntoIter<&str>>, [closure#src/main.rs:19:14: 23:10]>: TryStream`
which is required by `&futures::stream::Map<futures::stream::Iter<std::vec::IntoIter<&str>>, [closure#src/main.rs:19:14: 23:10]>: TryStreamExt`
`&mut futures::stream::Map<futures::stream::Iter<std::vec::IntoIter<&str>>, [closure#src/main.rs:19:14: 23:10]>: TryStream`
which is required by `&mut futures::stream::Map<futures::stream::Iter<std::vec::IntoIter<&str>>, [closure#src/main.rs:19:14: 23:10]>: TryStreamExt`
I could use buffer_unordered() but then I'm left with a stream with a double nested Result
and I was hoping to use try_buffer_unordered and try_collect().... any thoughts?
(Yes I know the read code has problems, it's just to illustrate the compile problem with StreamExt
(The alternative is something like a series of collects to try to get rid of the Results, which is ugly and uses up extra collections)
FWIW, what I was told from Tokio discord is that one cannot use try_buffer_unordered with a regular Future returned from a map. The try_* methods are intended for when the creation of the Future might not succeed, in other words something like a Result<Future, _>.

Resources