ma_deserialize_sp
This commit is contained in:
parent
eaa83b1bf0
commit
6cff44c652
@ -283,18 +283,30 @@ impl<SP: StaticPairAtomic> ParseMode for StaticPairObject<SP> {
|
|||||||
type Mode = <SP::B as ParseMode>::Mode;
|
type Mode = <SP::B as ParseMode>::Mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<SP: StaticPairAtomic> StaticPairObject<SP>
|
||||||
|
where
|
||||||
|
SP::A: InliningAtomic,
|
||||||
|
SP::B: AtomicModeParse,
|
||||||
|
{
|
||||||
|
pub fn ma_deserialize_sp<I: Stream>(stream: I) -> ModeResultP<Self, SP, SP::AParseError, I> {
|
||||||
|
let (a, stream) =
|
||||||
|
<SP::A as InliningAtomic>::a_ideserialize(stream).map_err(|e| SP::from_error_a(e))?;
|
||||||
|
Self::bind(
|
||||||
|
<SP::B as AtomicModeParse>::ma_deserialize(stream).map_err(|e| SP::from_error_b(e))?,
|
||||||
|
|b| SP::from_parsed(a, b),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<SP: StaticPairAtomic> AtomicModeParse for StaticPairObject<SP>
|
impl<SP: StaticPairAtomic> AtomicModeParse for StaticPairObject<SP>
|
||||||
where
|
where
|
||||||
SP::A: InliningAtomic,
|
SP::A: InliningAtomic,
|
||||||
SP::B: AtomicModeParse,
|
SP::B: AtomicModeParse,
|
||||||
{
|
{
|
||||||
fn ma_deserialize<I: Stream>(stream: I) -> AModeResultM<Self, I> {
|
fn ma_deserialize<I: Stream>(stream: I) -> AModeResultM<Self, I> {
|
||||||
let (a, stream) =
|
Ok(Self::map(Self::ma_deserialize_sp(stream)?, |pair| {
|
||||||
<SP::A as InliningAtomic>::a_ideserialize(stream).map_err(|e| SP::from_error_a(e))?;
|
StaticPairObject { pair }
|
||||||
Self::bind(
|
}))
|
||||||
<SP::B as AtomicModeParse>::ma_deserialize(stream).map_err(|e| SP::from_error_b(e))?,
|
|
||||||
|b| SP::from_parsed(a, b).map(|pair| StaticPairObject { pair }),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ma_extend(atomic: AExtensionSourceM<Self>, tail: &[u8]) -> AExtensionResultM<Self> {
|
fn ma_extend(atomic: AExtensionSourceM<Self>, tail: &[u8]) -> AExtensionResultM<Self> {
|
||||||
|
Loading…
Reference in New Issue
Block a user