[Awmp] Rust awmp persist_in() problem

I am a newbie and I am trying to change the temp_directory with awmp::PathConfig::with_temp_dir() inside a newly created actix app as an argument to .app_data(web::Data::new(-------)).

It gives me an error saying "expected value, found struct".

what could be the official way to change the temp location with awmp, so that the persist_in() function can work?

Can you paste the full error message you get when running cargo build? There's a good chance this is just a syntax error and the compiler's error message also included a suggestion that you could try.

async fn add_cat_form(
        pool: web::Data<DbPool>,
        mut parts: Parts,
    )-> Result<HttpResponse, Error>{
        let file_path = parts
            .and_then(|f| f.persist_in("./static/image").ok())

async fn main()-> std::io::Result<()>{
HttpServer::new(move|| {
                   Files::new("/static", "static")
               .route("/", web::get().to(index))
               .route("/add", web::get().to(add))
               .route("/add_cat_form", web::post().to(add_cat_form))
      }) ...

this is the code, here when i use the persist_in() function with std::env::temp_dir(), works well. But any other directory, it dosent read/write at all. There is no compiler error for this.Is there any way to change the directories other than std::env::temp_dir().

this was the syntax i was searching for and now the temp directory can be changed.
thankyou Michael-F-Bryan.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.