You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to download a single file using the retr function, but I can't seem to grasp the reader: F part. I attempted to get ChatGPT to explain but that resulted in "dyn async_std::io::Read cannot be unpinned".
Here is what I have so far, it contains the issue mentioned
pubasyncfndownload_file2(file_name:String) -> Result<(), suppaftp::FtpError>{//NOTE need to include portletmut ftp_stream = AsyncFtpStream::connect("127.0.0.1:21").await?;
ftp_stream.login("user","pass").await.expect("no login");//TODO env for this path, it also needs to prefix with /public
ftp_stream.cwd("/path/to/images").await?;match ftp_stream
.retr(file_name, |stream| {letmut buffer = Vec::new();// Cannot be unpinned
stream.read_vectored(&mut buffer);Ok(buffer)}).await{Ok(data) => {// Write the file to the local file systemeprintln!("shush");}Err(e) => {eprintln!("Failed to retrieve file: {}", e);}}// Logout and quit the session
ftp_stream.quit().await?;Ok(())}
I'm still learning so perhaps im missing something silly. Thanks in advance.
The text was updated successfully, but these errors were encountered:
I'm trying to download a single file using the retr function, but I can't seem to grasp the
reader: F
part. I attempted to get ChatGPT to explain but that resulted in "dyn async_std::io::Read
cannot be unpinned".Here is what I have so far, it contains the issue mentioned
I'm still learning so perhaps im missing something silly. Thanks in advance.
The text was updated successfully, but these errors were encountered: