mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-22 08:02:19 +00:00
36 lines
700 B
Rust
36 lines
700 B
Rust
/*
|
|
* Author: Ruben Fiszel
|
|
* Copyright: Windmill Labs, Inc 2022
|
|
* This file and its contents are licensed under the AGPLv3 License.
|
|
* Please see the included NOTICE for copyright information and
|
|
* LICENSE-AGPL for a copy of the license.
|
|
*/
|
|
|
|
//! helpers for serde + serde derive attributes
|
|
|
|
use crate::utils::rd_string;
|
|
|
|
pub fn default_true() -> bool {
|
|
true
|
|
}
|
|
|
|
pub fn default_false() -> bool {
|
|
false
|
|
}
|
|
|
|
pub fn default_null() -> serde_json::Value {
|
|
serde_json::Value::Null
|
|
}
|
|
|
|
pub fn default_empty_string() -> String {
|
|
String::new()
|
|
}
|
|
|
|
pub fn default_id() -> String {
|
|
rd_string(6)
|
|
}
|
|
|
|
pub fn is_default<T: Default + std::cmp::PartialEq>(t: &T) -> bool {
|
|
&T::default() == t
|
|
}
|