DEV Community

Discussion on: Upload content to AWS S3 with Rust 🦀

Collapse
 
rimutaka profile image
Max

Hm. I don't think you ran your code. It should let mut resp, but ideally it should be

let resp = match file {
  Ok(f) => {
    client
      .put_object()
      .bucket(bucket)
      .key(key)
      .body(f)
      .send()
      .await?
  },
  Err(e) => {
    panic!("Error uploading file: {:?}", e);
  }
};
Enter fullscreen mode Exit fullscreen mode

Also, there is no need for Debug ({:?}) for e because it implements Display which is expanded with {}. That line should look like this: panic!("Error uploading file: {}", e);