Lang change
This commit is contained in:
31
src/login_result.rs
Normal file
31
src/login_result.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
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> {
|
||||
return serde_json::to_string_pretty(&self);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user