0
src
 I -- handlers
         I--- authhandler.rs
      models
         I--- account.rs
         I--- mod.rs

authhandler:

pub fn register(register: web::Json<RegisterRequest>) -> impl Responder {
   .........
}

account:

pub struct RegisterRequest {
    email: String,
    password: String
}

mod.rs

pub mod account;

I have tried to use use models::account::RegisterRequest;and crate models::account::RegisterRequest None of this worked out.

How can import RegisterRequest into authhandler?

codeme
  • 861
  • 2
  • 12
  • 29

1 Answers1

0

I have found out that the RegisterRequest missed the use keyword and can be imported as:

use crate::models::account::RegisterRequest;
codeme
  • 861
  • 2
  • 12
  • 29