use crate::encoding::{
Decode, EmptyPayload, EmptyStruct, Encode, NoHandleResourceDialect, ValueTypeMarker,
};
use crate::persistence::Persistable;
pub trait Body:
Decode<Self::MarkerAtTopLevel, NoHandleResourceDialect>
+ Decode<Self::MarkerInResultUnion, NoHandleResourceDialect>
{
type MarkerAtTopLevel: ValueTypeMarker<Owned = Self>
+ ValueTypeMarker<Owned: Decode<Self::MarkerAtTopLevel, NoHandleResourceDialect>>
+ for<'a> ValueTypeMarker<
Borrowed<'a>: Encode<Self::MarkerAtTopLevel, NoHandleResourceDialect>,
>;
type MarkerInResultUnion: ValueTypeMarker<Owned = Self>
+ ValueTypeMarker<Owned: Decode<Self::MarkerInResultUnion, NoHandleResourceDialect>>
+ for<'a> ValueTypeMarker<
Borrowed<'a>: Encode<Self::MarkerInResultUnion, NoHandleResourceDialect>,
>;
}
pub trait ErrorType: Decode<Self::Marker, NoHandleResourceDialect> {
type Marker: ValueTypeMarker<Owned = Self>;
}
impl<T: Persistable> Body for T {
type MarkerAtTopLevel = Self;
type MarkerInResultUnion = Self;
}
impl Body for () {
type MarkerAtTopLevel = EmptyPayload;
type MarkerInResultUnion = EmptyStruct;
}
impl<E: ValueTypeMarker<Owned = E> + Decode<E, NoHandleResourceDialect>> ErrorType for E {
type Marker = Self;
}