mod arg;
mod result;
mod specta_fn;
pub use arg::FunctionArg;
pub use result::FunctionResult;
#[doc(hidden)]
pub use result::{FunctionResultFutureMarker, FunctionResultMarker};
pub(crate) use specta_fn::SpectaFn;
#[doc(hidden)]
#[macro_export]
macro_rules! _fn_datatype {
($($json:tt)*) => {
$crate::function::_fn_datatype_internal!($($json)*)
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! _fn_datatype_internal {
([$($path:tt)*] [$($full:tt)*] [$last:tt]) => {
$crate::internal::paste! {
$($path)* [<__specta__fn__ $last>]!(@export_fn; $($full)*)
}
};
([$($path:tt)*] [$($full:tt)*] [$($last:tt)?] $t:tt :: <$($g:path),*> $($rest:tt)*) => {
$crate::function::fn_datatype!([$($path)* $($last)*] [$($full)* $t::<$($g),*>] [$t] $($rest)*)
};
([$($path:tt)*] [$($full:tt)*] [$($last:tt)?] $t:tt $($rest:tt)*) => {
$crate::function::fn_datatype!([$($path)* $($last)*] [$($full)* $t] [$t] $($rest)*)
};
() => {{
compile_error!("fn_datatype must be provided a function path as an argument");
}};
($($rest:tt)*) => {
$crate::function::fn_datatype!([] [] [] $($rest)*)
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! _collect_functions {
($(,)?) => {{
fn export(_: &mut $crate::TypeCollection) -> Vec<$crate::datatype::Function> {
vec![]
}
export
}};
($($b:tt $(:: $($p:ident)? $(<$($g:path),*>)? )* ),* $(,)?) => {{
fn export(type_map: &mut $crate::TypeCollection) -> Vec<$crate::datatype::Function> {
vec![
$($crate::function::fn_datatype!($b $($(::$p)? $(::<$($g),*>)? )* )(type_map)),*
]
}
export
}};
}
#[doc(inline)]
pub use _collect_functions as collect_functions;
#[doc(inline)]
pub use _fn_datatype as fn_datatype;
#[doc(hidden)]
pub use _fn_datatype_internal;