delete AoProxy
This commit is contained in:
parent
3ce4a3b676
commit
678cb199ef
@ -36,25 +36,13 @@ impl<A: AtomicBase> Serializable for AtomicObject<A> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait AoProxy<'a, Ctx: Context<'a>> {
|
|
||||||
type A;
|
|
||||||
|
|
||||||
type Mtbl: MentionableBase<'a, Ctx, Fctr = Self::Fctr> + MentionableTop<'a, Ctx>;
|
|
||||||
type Fctr: FactoryBase<'a, Ctx, Mtbl = Self::Mtbl>;
|
|
||||||
|
|
||||||
fn factory() -> Self::Fctr;
|
|
||||||
fn wrap(a: Self::A) -> Self::Mtbl;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, A: AtomicBase + WithParseMode> MentionableBase<'a, Ctx>
|
impl<'a, Ctx: Context<'a>, A: AtomicBase + WithParseMode> MentionableBase<'a, Ctx>
|
||||||
for AtomicObject<A>
|
for AtomicObject<A>
|
||||||
where
|
|
||||||
A::WithMode: AoProxy<'a, Ctx, Mtbl = Self, A = A>,
|
|
||||||
{
|
{
|
||||||
type Fctr = <A::WithMode as AoProxy<'a, Ctx>>::Fctr;
|
type Fctr = AtomicFactory<A>;
|
||||||
|
|
||||||
fn factory(&self) -> Self::Fctr {
|
fn factory(&self) -> Self::Fctr {
|
||||||
<A::WithMode as AoProxy<'a, Ctx>>::factory()
|
AtomicFactory::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,11 +71,10 @@ impl<A: AtomicBase> Clone for AtomicFactory<A> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, A: AtomicBase + WithParseMode> FactoryBase<'a, Ctx> for AtomicFactory<A>
|
impl<'a, Ctx: Context<'a>, A: AtomicBase + WithParseMode> FactoryBase<'a, Ctx>
|
||||||
where
|
for AtomicFactory<A>
|
||||||
A::WithMode: AoProxy<'a, Ctx, Fctr = Self, A = A>,
|
|
||||||
{
|
{
|
||||||
type Mtbl = <A::WithMode as AoProxy<'a, Ctx>>::Mtbl;
|
type Mtbl = AtomicObject<A>;
|
||||||
|
|
||||||
type ParseError = A::AParseError;
|
type ParseError = A::AParseError;
|
||||||
}
|
}
|
||||||
@ -96,24 +83,6 @@ impl<A: ParseMode> ImplMode for AtomicFactory<A> {
|
|||||||
type Mode = A::Mode;
|
type Mode = A::Mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, A: RegularAtomic + ImplMode> AoProxy<'a, Ctx>
|
|
||||||
for WithMode<A, RegularMode>
|
|
||||||
{
|
|
||||||
type A = A;
|
|
||||||
|
|
||||||
type Mtbl = AtomicObject<A>;
|
|
||||||
|
|
||||||
type Fctr = AtomicFactory<A>;
|
|
||||||
|
|
||||||
fn factory() -> Self::Fctr {
|
|
||||||
AtomicFactory::new()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn wrap(a: Self::A) -> Self::Mtbl {
|
|
||||||
a.into()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, A: RegularAtomic + ImplMode> RegularFactory<'a, Ctx>
|
impl<'a, Ctx: Context<'a>, A: RegularAtomic + ImplMode> RegularFactory<'a, Ctx>
|
||||||
for AtomicFactory<A>
|
for AtomicFactory<A>
|
||||||
{
|
{
|
||||||
|
@ -86,8 +86,6 @@ pub trait ConstSizeAtomic: InliningAtomic {
|
|||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, A: ImplMode + InliningAtomic> InliningFactory<'a, Ctx>
|
impl<'a, Ctx: Context<'a>, A: ImplMode + InliningAtomic> InliningFactory<'a, Ctx>
|
||||||
for AtomicFactory<A>
|
for AtomicFactory<A>
|
||||||
where
|
|
||||||
<A as WithParseMode>::WithMode: AoProxy<'a, Ctx, Fctr = Self, A = A>,
|
|
||||||
{
|
{
|
||||||
fn extension_error(&self, tail: &[u8]) -> Self::ParseError {
|
fn extension_error(&self, tail: &[u8]) -> Self::ParseError {
|
||||||
A::a_extension_error(tail)
|
A::a_extension_error(tail)
|
||||||
@ -95,17 +93,12 @@ where
|
|||||||
|
|
||||||
fn ideserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> IParseResult<'a, Ctx, Self, I> {
|
fn ideserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> IParseResult<'a, Ctx, Self, I> {
|
||||||
let (a, inctx) = A::a_ideserialize(inctx)?;
|
let (a, inctx) = A::a_ideserialize(inctx)?;
|
||||||
Ok((
|
Ok((a.into(), inctx))
|
||||||
<<A as WithParseMode>::WithMode as AoProxy<'a, Ctx>>::wrap(a),
|
|
||||||
inctx,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, A: ImplMode + ConstSizeAtomic> FixedSizeFactory<'a, Ctx>
|
impl<'a, Ctx: Context<'a>, A: ImplMode + ConstSizeAtomic> FixedSizeFactory<'a, Ctx>
|
||||||
for AtomicFactory<A>
|
for AtomicFactory<A>
|
||||||
where
|
|
||||||
<A as WithParseMode>::WithMode: AoProxy<'a, Ctx, Fctr = Self, A = A>,
|
|
||||||
{
|
{
|
||||||
fn size(&self) -> usize {
|
fn size(&self) -> usize {
|
||||||
A::SIZE
|
A::SIZE
|
||||||
@ -114,8 +107,6 @@ where
|
|||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, A: ImplMode + ConstSizeAtomic> ConstSizeFactory<'a, Ctx>
|
impl<'a, Ctx: Context<'a>, A: ImplMode + ConstSizeAtomic> ConstSizeFactory<'a, Ctx>
|
||||||
for AtomicFactory<A>
|
for AtomicFactory<A>
|
||||||
where
|
|
||||||
<A as WithParseMode>::WithMode: AoProxy<'a, Ctx, Fctr = Self, A = A>,
|
|
||||||
{
|
{
|
||||||
const SIZE: usize = A::SIZE;
|
const SIZE: usize = A::SIZE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user