user_and_salt #27
26
src/user.rs
26
src/user.rs
@@ -59,3 +59,29 @@ impl User {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod salt {
|
||||
use std::default::Default;
|
||||
|
||||
use crate::init;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
pub struct Salt {
|
||||
#[serde(skip_serializing_if = "init::is_uuid_nil")]
|
||||
pub id: uuid::Uuid,
|
||||
#[serde(skip_serializing_if = "String::is_empty")]
|
||||
pub salt: String,
|
||||
}
|
||||
|
||||
impl Salt {
|
||||
pub fn to_json(&self, output_pretty: bool) -> Result<String, serde_json::Error> {
|
||||
if output_pretty {
|
||||
serde_json::to_string_pretty(&self)
|
||||
} else {
|
||||
serde_json::to_string(&self)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user