Crate tosho_macros

Crate tosho_macros 

Source
Expand description

§tosho-macros

A collection of macros used by tosho and the other sources crates.

§License

This project is licensed with MIT License (LICENSE or http://opensource.org/licenses/MIT)

Macros§

comptime_b64
Create a decoded base64 string at compile time.
enum_error
Create an error struct for an enum that implements std::fmt::Display that can be used when using other macros to derive std::str::FromStr for an enum.

Derive Macros§

AutoDocFields
Create a function that is derived from the enum and returns the documentation of the variant as a static string that can be used.
AutoGetter
Derive the AutoGetter macro for a struct
DeserializeEnum
Derives serde::Deserialize for an enum using std::str::FromStr
DeserializeEnum32
Derives serde::Deserialize for an enum in i32 mode.
DeserializeEnum32Fallback
Derives serde::Deserialize for an enum in i32 mode with fallback to std::default::Default.
EnumCount
Derives an enum that would implement ::count() to return the number of variants
EnumName
Derives an enum that would implement .to_name()
EnumU32
Derives an enum that would implement From<u32>.
EnumU32Fallback
Derives an enum that would implement From<u32> with fallback.
ProstEnumUnrecognized
A custom derive macro that follows similar pattern to prost::Enumeration
SerializeEnum
Derives serde::Serialize for an enum using std::fmt::Display
SerializeEnum32
Derives serde::Serialize for an enum in i32 mode.