QInliningFactory
-> CInliningFactory
This commit is contained in:
parent
cf7ff1b5b8
commit
ff13bce63f
@ -205,16 +205,16 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, F: Factory<'a, Ctx> + InliningFactory<'a, Ctx>> QInliningFactory<'a, Ctx>
|
impl<'a, Ctx: Context<'a>, F: Factory<'a, Ctx> + InliningFactory<'a, Ctx>> CInliningFactory<'a, Ctx>
|
||||||
for StackNodeFactory<F>
|
for StackNodeFactory<F>
|
||||||
where
|
where
|
||||||
F::Mtbl: MentionableTop<'a, Ctx>,
|
F::Mtbl: MentionableTop<'a, Ctx>,
|
||||||
{
|
{
|
||||||
fn qextension_error(&self, tail: &[u8]) -> Self::ParseError {
|
fn cextension_error(&self, tail: &[u8]) -> Self::ParseError {
|
||||||
StackParseError::Element(self.element_factory.extension_error(tail))
|
StackParseError::Element(self.element_factory.extension_error(tail))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn qideserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> IParseResult<'a, Ctx, Self, I> {
|
fn cideserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> IParseResult<'a, Ctx, Self, I> {
|
||||||
let (rest, inctx) = self.parse_point(inctx)?;
|
let (rest, inctx) = self.parse_point(inctx)?;
|
||||||
let (element, inctx) = self
|
let (element, inctx) = self
|
||||||
.element_factory
|
.element_factory
|
||||||
|
@ -172,12 +172,12 @@ impl<F> ImplMode for TreeFactory<F> {
|
|||||||
type Mode = InliningMode;
|
type Mode = InliningMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>> QInliningFactory<'a, Ctx> for TreeFactory<F> {
|
impl<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>> CInliningFactory<'a, Ctx> for TreeFactory<F> {
|
||||||
fn qextension_error(&self, tail: &[u8]) -> Self::ParseError {
|
fn cextension_error(&self, tail: &[u8]) -> Self::ParseError {
|
||||||
u64::a_extension_error(tail).into()
|
u64::a_extension_error(tail).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn qideserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> IParseResult<'a, Ctx, Self, I> {
|
fn cideserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> IParseResult<'a, Ctx, Self, I> {
|
||||||
let (node, inctx) = self.0.ideserialize(inctx)?;
|
let (node, inctx) = self.0.ideserialize(inctx)?;
|
||||||
let (height, inctx) = u64::a_ideserialize(inctx)?;
|
let (height, inctx) = u64::a_ideserialize(inctx)?;
|
||||||
let tree = Tree { node, height };
|
let tree = Tree { node, height };
|
||||||
|
@ -14,12 +14,12 @@ pub use self::modes::InliningMode;
|
|||||||
|
|
||||||
pub type IParseResult<'a, Ctx, F, I> = Result<(Mtbl<'a, Ctx, F>, I), ParseError<'a, Ctx, F>>;
|
pub type IParseResult<'a, Ctx, F, I> = Result<(Mtbl<'a, Ctx, F>, I), ParseError<'a, Ctx, F>>;
|
||||||
|
|
||||||
pub trait QInliningFactory<'a, Ctx: Context<'a>>:
|
pub trait CInliningFactory<'a, Ctx: Context<'a>>:
|
||||||
FactoryBase<'a, Ctx> + ImplMode<Mode = InliningMode>
|
FactoryBase<'a, Ctx> + ImplMode<Mode = InliningMode>
|
||||||
{
|
{
|
||||||
fn qextension_error(&self, tail: &[u8]) -> Self::ParseError;
|
fn cextension_error(&self, tail: &[u8]) -> Self::ParseError;
|
||||||
|
|
||||||
fn qideserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> IParseResult<'a, Ctx, Self, I>;
|
fn cideserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> IParseResult<'a, Ctx, Self, I>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This factory should return an error on EOF.
|
/// This factory should return an error on EOF.
|
||||||
|
@ -66,13 +66,13 @@ impl Mode for InliningMode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, F: QInliningFactory<'a, Ctx>> FactoryModeProxy<'a, Ctx>
|
impl<'a, Ctx: Context<'a>, F: CInliningFactory<'a, Ctx>> FactoryModeProxy<'a, Ctx>
|
||||||
for WithMode<F, InliningMode>
|
for WithMode<F, InliningMode>
|
||||||
{
|
{
|
||||||
type F = F;
|
type F = F;
|
||||||
|
|
||||||
fn pmdeserialize<I: InCtx<'a, Ctx>>(f: &Self::F, inctx: I) -> ModeResultM<'a, Ctx, F, I> {
|
fn pmdeserialize<I: InCtx<'a, Ctx>>(f: &Self::F, inctx: I) -> ModeResultM<'a, Ctx, F, I> {
|
||||||
f.qideserialize(inctx)
|
f.cideserialize(inctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pmextend(
|
fn pmextend(
|
||||||
@ -80,7 +80,7 @@ impl<'a, Ctx: Context<'a>, F: QInliningFactory<'a, Ctx>> FactoryModeProxy<'a, Ct
|
|||||||
_mentionable: ExtensionSourceM<'a, Ctx, F>,
|
_mentionable: ExtensionSourceM<'a, Ctx, F>,
|
||||||
tail: &[u8],
|
tail: &[u8],
|
||||||
) -> ExtensionResultM<'a, Ctx, F> {
|
) -> ExtensionResultM<'a, Ctx, F> {
|
||||||
f.qextension_error(tail)
|
f.cextension_error(tail)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,14 +107,14 @@ impl<'a, Ctx: Context<'a>, A: MentionableBase<'a, Ctx>> Clone for Nullable<'a, C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, F: FactoryBase<'a, Ctx>> QInliningFactory<'a, Ctx>
|
impl<'a, Ctx: Context<'a>, F: FactoryBase<'a, Ctx>> CInliningFactory<'a, Ctx>
|
||||||
for NullableFactory<F>
|
for NullableFactory<F>
|
||||||
{
|
{
|
||||||
fn qextension_error(&self, tail: &[u8]) -> Self::ParseError {
|
fn cextension_error(&self, tail: &[u8]) -> Self::ParseError {
|
||||||
PointParseError::WrongLength(HASH_SIZE + tail.len())
|
PointParseError::WrongLength(HASH_SIZE + tail.len())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn qideserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> IParseResult<'a, Ctx, Self, I> {
|
fn cideserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> IParseResult<'a, Ctx, Self, I> {
|
||||||
let factory = self.factory.clone();
|
let factory = self.factory.clone();
|
||||||
let (address, inctx) = inctx.icnext_address(|slice| PointParseError::from(slice))?;
|
let (address, inctx) = inctx.icnext_address(|slice| PointParseError::from(slice))?;
|
||||||
Ok((
|
Ok((
|
||||||
|
@ -83,12 +83,12 @@ impl<F> ImplMode for PointFactory<F> {
|
|||||||
type Mode = InliningMode;
|
type Mode = InliningMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, F: FactoryBase<'a, Ctx>> QInliningFactory<'a, Ctx> for PointFactory<F> {
|
impl<'a, Ctx: Context<'a>, F: FactoryBase<'a, Ctx>> CInliningFactory<'a, Ctx> for PointFactory<F> {
|
||||||
fn qextension_error(&self, tail: &[u8]) -> Self::ParseError {
|
fn cextension_error(&self, tail: &[u8]) -> Self::ParseError {
|
||||||
PointParseError::WrongLength(HASH_SIZE + tail.len())
|
PointParseError::WrongLength(HASH_SIZE + tail.len())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn qideserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> IParseResult<'a, Ctx, Self, I> {
|
fn cideserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> IParseResult<'a, Ctx, Self, I> {
|
||||||
inctx.icnext_point(self.inner(), |slice| PointParseError::from(slice))
|
inctx.icnext_point(self.inner(), |slice| PointParseError::from(slice))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user