use crate::{AbiClass, ClassMutPtr, ClassPtr, ClassRef, ClassRefMut};
use std::marker::PhantomData;
pub trait AbiType: Sized {
type InputType;
type InputRef<'a> where Self: 'a;
type InputRefMut<'a> where Self: 'a;
type InputPtr<'a, P, const N: usize> where Self: 'a;
type InputMutPtr<'a, P, const N: usize> where Self: 'a;
type OutputType;
type OutputRef<'a> where Self: 'a;
type OutputRefMut<'a> where Self: 'a;
type OutputPtr<'a, P, const N: usize> where Self: 'a;
type OutputMutPtr<'a, P, const N: usize> where Self: 'a;
}
pub struct Pod<T: Sized>(PhantomData<T>);
unsafe impl<T: Send> Send for Pod<T> {}
unsafe impl<T: Sync> Sync for Pod<T> {}
impl<T: Sized> AbiType for Pod<T> {
type InputType = T;
type InputRef<'a> = &'a T where T: 'a;
type InputRefMut<'a> = &'a mut T where T: 'a;
type InputPtr<'a, P, const N: usize> = P where T: 'a;
type InputMutPtr<'a, P, const N: usize> = P where T: 'a;
type OutputType = T;
type OutputRef<'a> = &'a T where T: 'a;
type OutputRefMut<'a> = &'a mut T where T: 'a;
type OutputPtr<'a, P, const N: usize> = P where T: 'a;
type OutputMutPtr<'a, P, const N: usize> = P where T: 'a;
}
impl<T: AbiClass> AbiType for T {
type InputType = T;
type InputRef<'a> = &'a T where T: 'a;
type InputRefMut<'a> = &'a mut T where T: 'a;
type InputPtr<'a, P, const N: usize> = &'a ClassPtr<'a, T, N> where T: 'a;
type InputMutPtr<'a, P, const N: usize> = &'a ClassMutPtr<'a, T, N> where T: 'a;
type OutputType = T;
type OutputRef<'a> = ClassRef<'a, T> where T: 'a;
type OutputRefMut<'a> = ClassRefMut<'a, T> where T: 'a;
type OutputPtr<'a, P, const N: usize> = ClassPtr<'a, T, N> where T: 'a;
type OutputMutPtr<'a, P, const N: usize> = ClassMutPtr<'a, T, N> where T: 'a;
}