Module field_attributes

Source
Expand description

Contains helpers for the fields.

Structs§

StringOrVecToVec
Builder to create a parser, that parses a separated string or a vec into a vec.

Enums§

Pattern
Pattern on which a string can be split.

Functions§

bool_true
Allows a bool field to be defaulted to true, rather than the normal default of false. Useful for fields where the default value should be true.
default_i16
Allows compact setting i16 field default value.
default_i32
Allows compact setting i32 field default value.
default_i64
Allows compact setting i64 field default value.
default_u16
Allows compact setting u16 field default value.
default_u32
Allows compact setting u32 field default value.
default_u64
Allows compact setting u64 field default value.
deserialize_bool_from_anything
Deserializes boolean from anything (string, number, boolean). If input is a string, it is expected, that it is possible to convert it to a number. The return boolean is true if the number was either 1 or 1.0 after parsing.
deserialize_cell_option_number_from_string
Deserializes a Cell option number from string or a number. Same logic as "deserialize_option_number_from_string".
deserialize_datetime_utc_from_milliseconds
Deserializes a chrono::DateTime<Utc> from a milliseconds time stamp. Useful when the data is coming from a number which is not a seconds time stamp but milliseconds one. It also handles the string to number conversion if the data was passed as a string with number inside like “1519927261900”.
deserialize_datetime_utc_from_seconds
Deserializes a chrono::DateTime<Utc> from a seconds time stamp. It also handles the string to number conversion if the data was passed as a string with number inside like “1519927261”.
deserialize_default_from_empty_object
Deserializes default value from nullable value or empty object. If the original value is null or {}, Default::default() is used.
deserialize_default_from_null
Deserializes default value from nullable value. If the original value is null, Default::default() is used.
deserialize_mutex_option_number_from_string
Deserializes a Mutex option number from string or a number. Same logic as "deserialize_option_number_from_string".
deserialize_number_from_string
Deserializes a number from string or a number.
deserialize_option_number_from_string
Deserializes an option number from string or a number.
deserialize_ref_cell_option_number_from_string
Deserializes a RefCell option number from string or a number. Same logic as "deserialize_option_number_from_string".
deserialize_rw_lock_option_number_from_string
Deserializes a RwLock option number from string or a number. Same logic as "deserialize_option_number_from_string".
deserialize_string_from_number
Deserializes string from a number. If the original value is a number value, it will be converted to a string.
deserialize_to_type_or_fallback
Deserialize to primary or fallback type.
deserialize_to_type_or_none
Deserialize to a given type, while ignoring any invalid fields.
deserialize_to_type_or_string_lossy
Deserialize to a given type, while returning invalid fields as String.
deserialize_vec_from_string_or_vec
Deserializes a comma separated string into a Vec<T>.

Type Aliases§

StringOrVecParser
A functor returning a Result of parsing a string into a vector of objects of type T.