use std::future::Future;
use crate::{DataType, Type, TypeMap};
pub trait FunctionResult<TMarker> {
fn to_datatype(type_map: &mut TypeMap) -> DataType;
}
pub enum FunctionResultMarker {}
impl<T: Type> FunctionResult<FunctionResultMarker> for T {
fn to_datatype(type_map: &mut TypeMap) -> DataType {
T::reference(type_map, &[]).inner
}
}
pub enum FunctionResultFutureMarker {}
impl<F> FunctionResult<FunctionResultFutureMarker> for F
where
F: Future,
F::Output: Type,
{
fn to_datatype(type_map: &mut TypeMap) -> DataType {
F::Output::reference(type_map, &[]).inner
}
}