-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
E-has-instructionsIssue has some instructions and pointers to code to get startedIssue has some instructions and pointers to code to get started
Description
(Edit: In this example) rustc returns a nice error if you forget to import a needed trait - it would be nice to have a suggestion in rust-analyser to add the use statement.
use tokio::io::AsyncWrite;
pub struct PlaylistWriter<F: AsyncWrite + Unpin + Send> {
playlist_file: F,
}
impl<F: AsyncWrite + Unpin + Send> PlaylistWriter<F> {
pub async fn start(mut playlist_file: F) -> eyre::Result<Self> {
playlist_file.write_all(b"#EXTM3U\n").await?;
Ok(PlaylistWriter { playlist_file })
}
}error[E0599]: no method named `write_all` found for type parameter `F` in the current scope
--> src/temp.rs:9:23
|
9 | playlist_file.write_all(b"#EXTM3U\n").await?;
| ^^^^^^^^^ method not found in `F`
|
= help: items from traits can only be used if the trait is in scope
= note: the following trait is implemented but not in scope; perhaps add a `use` for it:
`use tokio::io::util::async_write_ext::AsyncWriteExt;`
In this case, the ideal would be to suggest updating the use statement to:
use tokio::io::{AsyncWrite, AsyncWriteExt};Metadata
Metadata
Assignees
Labels
E-has-instructionsIssue has some instructions and pointers to code to get startedIssue has some instructions and pointers to code to get started