Some checks failed
Rust Build / Check (pull_request) Failing after 25s
Rust Build / Test Suite (pull_request) Failing after 26s
Rust Build / Rustfmt (pull_request) Successful in 26s
Rust Build / Clippy (pull_request) Failing after 28s
Rust Build / build (pull_request) Failing after 25s
32 lines
690 B
Rust
32 lines
690 B
Rust
use std::default::Default;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct LoginResult {
|
|
pub id: i32,
|
|
pub username: String,
|
|
pub token: String,
|
|
#[serde(alias = "token_type")]
|
|
pub token_type: String,
|
|
pub expiration: i32,
|
|
}
|
|
|
|
impl Default for LoginResult {
|
|
fn default() -> Self {
|
|
LoginResult {
|
|
id: -1,
|
|
username: String::new(),
|
|
token: String::new(),
|
|
token_type: String::new(),
|
|
expiration: -1,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl LoginResult {
|
|
pub fn _to_json(&self) -> Result<String, serde_json::Error> {
|
|
serde_json::to_string_pretty(&self)
|
|
}
|
|
}
|