Macro specta::fn_datatype
source · macro_rules! fn_datatype { ($function:path) => { ... }; ($type_map:ident; $function:path) => { ... }; }
Available on crate feature
function only.Expand description
Returns a FunctionDataType for a given function that has been annotated with
specta.
§Examples
use specta::*;
#[specta]
fn some_function(name: String, age: i32) -> bool {
true
}
fn main() {
let typ = fn_datatype!(some_function);
assert_eq!(typ.name, "some_function");
assert_eq!(typ.args.len(), 2);
assert_eq!(typ.result, Some(DataType::Primitive(PrimitiveType::bool)));
}