v_auth_service/
lib.rs

1#![allow(dead_code, unused_variables)]
2use rand::prelude::*;
3
4// current crate has two sub-modules.
5mod database;
6mod auth_utils;
7
8// 'use' declaration is a shorthand for referencing fully qualified symbols
9// that are defined somewhere within our module tree.
10// (which is different than importing an external dependency.)
11//
12// Crate Module 에서 Credentials 함수를 사용하면
13// auth_utils::models 에 있는 Credentials 를 사용한다.
14pub use auth_utils::models::Credentials;
15use database::Status;
16
17pub fn authenticate(creds: Credentials) {
18    let timeout = thread_rng().gen_range(100..500);
19    println!("The timeout is {timeout}ms");
20    if let Status::Connected = database::connect_to_database() {
21        auth_utils::login(creds);
22    }
23}