impl AtomicModeParse

This commit is contained in:
AF 2023-07-29 20:33:10 +00:00
parent e90aadf67c
commit ef250932b6

View File

@ -39,11 +39,28 @@ pub trait AtomicModeParse: AtomicBase + ParseMode {
pub trait AtomicModeProxy {
type A: AtomicBase + ParseMode;
fn ma_deserialize<I: Inlining>(inlining: I) -> AParseResultM<Self::A, I>;
fn pma_deserialize<I: Inlining>(inlining: I) -> AParseResultM<Self::A, I>;
fn ma_extend(atomic: AExtensionSourceM<Self::A>, tail: &[u8]) -> AExtensionResultM<Self::A>;
fn pma_extend(atomic: AExtensionSourceM<Self::A>, tail: &[u8]) -> AExtensionResultM<Self::A>;
fn ma_prepare(atomic: Self::A) -> AExtensionSourceM<Self::A>;
fn pma_prepare(atomic: Self::A) -> AExtensionSourceM<Self::A>;
}
impl<A: AtomicBase + WithParseMode> AtomicModeParse for A
where
<A as WithParseMode>::WithMode: AtomicModeProxy<A = A>,
{
fn ma_deserialize<I: Inlining>(inlining: I) -> AParseResultM<Self, I> {
<<A as WithParseMode>::WithMode as AtomicModeProxy>::pma_deserialize(inlining)
}
fn ma_extend(atomic: AExtensionSourceM<Self>, tail: &[u8]) -> AExtensionResultM<Self> {
<<A as WithParseMode>::WithMode as AtomicModeProxy>::pma_extend(atomic, tail)
}
fn ma_prepare(self) -> AExtensionSourceM<Self> {
<<A as WithParseMode>::WithMode as AtomicModeProxy>::pma_prepare(self)
}
}
pub trait RegularAtomic: AtomicBase + ImplMode<Mode = RegularMode> {