"inlineable" -> "inlining"
This commit is contained in:
parent
5a5f1f5199
commit
7d07f5ffea
@ -42,7 +42,7 @@ impl<const N: usize> ImplMode for [u8; N] {
|
|||||||
type Mode = InliningMode;
|
type Mode = InliningMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<const N: usize> InlineableAtomic for [u8; N] {
|
impl<const N: usize> InliningAtomic for [u8; N] {
|
||||||
fn a_extension_error(tail: &[u8]) -> Self::AParseError {
|
fn a_extension_error(tail: &[u8]) -> Self::AParseError {
|
||||||
ArrayParseError::ExtraData(tail.len())
|
ArrayParseError::ExtraData(tail.len())
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ impl ImplMode for u64 {
|
|||||||
type Mode = InliningMode;
|
type Mode = InliningMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InlineableAtomic for u64 {
|
impl InliningAtomic for u64 {
|
||||||
fn a_extension_error(tail: &[u8]) -> Self::AParseError {
|
fn a_extension_error(tail: &[u8]) -> Self::AParseError {
|
||||||
IntParseError::ExtraData(tail.len())
|
IntParseError::ExtraData(tail.len())
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ impl ImplMode for bool {
|
|||||||
type Mode = InliningMode;
|
type Mode = InliningMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InlineableAtomic for bool {
|
impl InliningAtomic for bool {
|
||||||
fn a_extension_error(tail: &[u8]) -> Self::AParseError {
|
fn a_extension_error(tail: &[u8]) -> Self::AParseError {
|
||||||
BooleanParseError::ExtraData(tail.len())
|
BooleanParseError::ExtraData(tail.len())
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ impl<ErrorA: Error, ErrorB: Error> Error for PairParseError<ErrorA, ErrorB> {}
|
|||||||
impl<'a, Ctx: Context<'a>, A: MentionableBase<'a, Ctx>, B: MentionableBase<'a, Ctx>>
|
impl<'a, Ctx: Context<'a>, A: MentionableBase<'a, Ctx>, B: MentionableBase<'a, Ctx>>
|
||||||
StaticPair<'a, Ctx> for (A, B)
|
StaticPair<'a, Ctx> for (A, B)
|
||||||
where
|
where
|
||||||
A::Fctr: InlineableFactory<'a, Ctx>,
|
A::Fctr: InliningFactory<'a, Ctx>,
|
||||||
B::Fctr: ParseMode,
|
B::Fctr: ParseMode,
|
||||||
{
|
{
|
||||||
type FactoryData = (Self::FA, Self::FB);
|
type FactoryData = (Self::FA, Self::FB);
|
||||||
|
@ -229,7 +229,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, F: ImplMode + InlineableFactory<'a, Ctx>>
|
impl<'a, Ctx: Context<'a>, F: ImplMode + InliningFactory<'a, Ctx>>
|
||||||
ExternalPointsProxy<'a, Ctx, Stack<'a, Ctx, Mtbl<'a, Ctx, F>>> for WithMode<F, InliningMode>
|
ExternalPointsProxy<'a, Ctx, Stack<'a, Ctx, Mtbl<'a, Ctx, F>>> for WithMode<F, InliningMode>
|
||||||
where
|
where
|
||||||
F::Mtbl: MentionableTop<'a, Ctx>,
|
F::Mtbl: MentionableTop<'a, Ctx>,
|
||||||
@ -242,7 +242,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, F: ImplMode + InlineableFactory<'a, Ctx>> InlineableFactory<'a, Ctx>
|
impl<'a, Ctx: Context<'a>, F: ImplMode + InliningFactory<'a, Ctx>> InliningFactory<'a, Ctx>
|
||||||
for StackNodeFactory<F>
|
for StackNodeFactory<F>
|
||||||
where
|
where
|
||||||
F::Mtbl: MentionableTop<'a, Ctx>,
|
F::Mtbl: MentionableTop<'a, Ctx>,
|
||||||
|
@ -172,7 +172,7 @@ impl<F> ImplMode for TreeFactory<F> {
|
|||||||
type Mode = InliningMode;
|
type Mode = InliningMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>> InlineableFactory<'a, Ctx> for TreeFactory<F> {
|
impl<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>> InliningFactory<'a, Ctx> for TreeFactory<F> {
|
||||||
fn extension_error(&self, tail: &[u8]) -> Self::ParseError {
|
fn extension_error(&self, tail: &[u8]) -> Self::ParseError {
|
||||||
u64::a_extension_error(tail).into()
|
u64::a_extension_error(tail).into()
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ 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>>;
|
||||||
|
|
||||||
/// This factory should return an error on EOF.
|
/// This factory should return an error on EOF.
|
||||||
pub trait InlineableFactory<'a, Ctx: Context<'a>>:
|
pub trait InliningFactory<'a, Ctx: Context<'a>>:
|
||||||
FactoryBase<'a, Ctx> + ParseMode<Mode = InliningMode>
|
FactoryBase<'a, Ctx> + ParseMode<Mode = InliningMode>
|
||||||
{
|
{
|
||||||
fn extension_error(&self, tail: &[u8]) -> Self::ParseError;
|
fn extension_error(&self, tail: &[u8]) -> Self::ParseError;
|
||||||
@ -24,7 +24,7 @@ pub trait InlineableFactory<'a, Ctx: Context<'a>>:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// This factory always reads the same amount of bytes or returns error.
|
/// This factory always reads the same amount of bytes or returns error.
|
||||||
pub trait FixedSizeFactory<'a, Ctx: Context<'a>>: InlineableFactory<'a, Ctx> {
|
pub trait FixedSizeFactory<'a, Ctx: Context<'a>>: InliningFactory<'a, Ctx> {
|
||||||
/// For [`ConstSizeFactory`] this must return [`ConstSizeFactory::SIZE`].
|
/// For [`ConstSizeFactory`] this must return [`ConstSizeFactory::SIZE`].
|
||||||
fn size(&self) -> usize;
|
fn size(&self) -> usize;
|
||||||
}
|
}
|
||||||
@ -35,11 +35,11 @@ pub trait ConstSizeFactory<'a, Ctx: Context<'a>>: FixedSizeFactory<'a, Ctx> {
|
|||||||
const SIZE: usize;
|
const SIZE: usize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Object analogue of [`InlineableFactory`].
|
/// Object analogue of [`InliningFactory`].
|
||||||
pub trait InlineableObject<'a, Ctx: Context<'a>>: Mentionable<'a, Ctx> {}
|
pub trait InliningObject<'a, Ctx: Context<'a>>: Mentionable<'a, Ctx> {}
|
||||||
|
|
||||||
/// Object analogue of [`FixedSizeFactory`].
|
/// Object analogue of [`FixedSizeFactory`].
|
||||||
pub trait FixedSizeObject<'a, Ctx: Context<'a>>: InlineableObject<'a, Ctx> {
|
pub trait FixedSizeObject<'a, Ctx: Context<'a>>: InliningObject<'a, Ctx> {
|
||||||
/// For [`ConstSizeObject`] this must return [`ConstSizeObject::SIZE`].
|
/// For [`ConstSizeObject`] this must return [`ConstSizeObject::SIZE`].
|
||||||
fn size(&self) -> usize;
|
fn size(&self) -> usize;
|
||||||
}
|
}
|
||||||
@ -52,8 +52,8 @@ pub trait ConstSizeObject<'a, Ctx: Context<'a>>: FixedSizeObject<'a, Ctx> {
|
|||||||
|
|
||||||
pub type ADParseResult<A, D> = Result<(A, D), AParseError<A>>;
|
pub type ADParseResult<A, D> = Result<(A, D), AParseError<A>>;
|
||||||
|
|
||||||
/// Atomic analogue of [`InlineableFactory`]/[`InlineableObject`].
|
/// Atomic analogue of [`InliningFactory`]/[`InliningObject`].
|
||||||
pub trait InlineableAtomic: AtomicBase + ImplMode<Mode = InliningMode> {
|
pub trait InliningAtomic: AtomicBase + ImplMode<Mode = InliningMode> {
|
||||||
fn a_extension_error(tail: &[u8]) -> Self::AParseError;
|
fn a_extension_error(tail: &[u8]) -> Self::AParseError;
|
||||||
|
|
||||||
fn a_ideserialize<D: Inlining>(inlining: D) -> ADParseResult<Self, D>;
|
fn a_ideserialize<D: Inlining>(inlining: D) -> ADParseResult<Self, D>;
|
||||||
@ -64,11 +64,11 @@ pub trait InlineableAtomic: AtomicBase + ImplMode<Mode = InliningMode> {
|
|||||||
/// Note: `FixedSizeAtomic` doesn't exist because it would
|
/// Note: `FixedSizeAtomic` doesn't exist because it would
|
||||||
/// either be const anyway
|
/// either be const anyway
|
||||||
/// or have a very undesireable implementation.
|
/// or have a very undesireable implementation.
|
||||||
pub trait ConstSizeAtomic: InlineableAtomic {
|
pub trait ConstSizeAtomic: InliningAtomic {
|
||||||
const SIZE: usize;
|
const SIZE: usize;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, A: InlineableAtomic> InlineableFactory<'a, Ctx> for AtomicFactory<A>
|
impl<'a, Ctx: Context<'a>, A: InliningAtomic> InliningFactory<'a, Ctx> for AtomicFactory<A>
|
||||||
where
|
where
|
||||||
<A as WithParseMode>::WithMode: AoProxy<'a, Ctx, Fctr = Self, A = A>,
|
<A as WithParseMode>::WithMode: AoProxy<'a, Ctx, Fctr = Self, A = A>,
|
||||||
{
|
{
|
||||||
@ -101,8 +101,8 @@ where
|
|||||||
const SIZE: usize = A::SIZE;
|
const SIZE: usize = A::SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> InlineableObject<'a, Ctx> for A where
|
impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> InliningObject<'a, Ctx> for A where
|
||||||
A::Fctr: InlineableFactory<'a, Ctx>
|
A::Fctr: InliningFactory<'a, Ctx>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,8 +224,8 @@ pub trait AlwaysFixedSize {
|
|||||||
fn _size(&self) -> usize;
|
fn _size(&self) -> usize;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, F: AlwaysFixedSize + InlineableFactory<'a, Ctx>>
|
impl<'a, Ctx: Context<'a>, F: AlwaysFixedSize + InliningFactory<'a, Ctx>> FixedSizeFactory<'a, Ctx>
|
||||||
FixedSizeFactory<'a, Ctx> for F
|
for F
|
||||||
{
|
{
|
||||||
fn size(&self) -> usize {
|
fn size(&self) -> usize {
|
||||||
self._size()
|
self._size()
|
||||||
@ -243,8 +243,8 @@ impl<F: AlwaysConstSize> AlwaysFixedSize for F {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, F: AlwaysConstSize + InlineableFactory<'a, Ctx>>
|
impl<'a, Ctx: Context<'a>, F: AlwaysConstSize + InliningFactory<'a, Ctx>> ConstSizeFactory<'a, Ctx>
|
||||||
ConstSizeFactory<'a, Ctx> for F
|
for F
|
||||||
{
|
{
|
||||||
const SIZE: usize = Self::_SIZE;
|
const SIZE: usize = Self::_SIZE;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ impl Mode for InliningMode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, F: InlineableFactory<'a, Ctx>> FactoryModeProxy<'a, Ctx>
|
impl<'a, Ctx: Context<'a>, F: InliningFactory<'a, Ctx>> FactoryModeProxy<'a, Ctx>
|
||||||
for WithMode<F, InliningMode>
|
for WithMode<F, InliningMode>
|
||||||
{
|
{
|
||||||
type F = F;
|
type F = F;
|
||||||
@ -68,7 +68,7 @@ impl<'a, Ctx: Context<'a>, F: InlineableFactory<'a, Ctx>> FactoryModeProxy<'a, C
|
|||||||
fn pmprepare(_mentionable: Mtbl<'a, Ctx, Self::F>) -> ExtensionSourceM<'a, Ctx, Self::F> {}
|
fn pmprepare(_mentionable: Mtbl<'a, Ctx, Self::F>) -> ExtensionSourceM<'a, Ctx, Self::F> {}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A: InlineableAtomic> AtomicProxy for WithMode<A, InliningMode> {
|
impl<A: InliningAtomic> AtomicProxy for WithMode<A, InliningMode> {
|
||||||
type A = A;
|
type A = A;
|
||||||
|
|
||||||
fn pa_deserialize(inlining: impl Inlining) -> AParseResult<Self::A> {
|
fn pa_deserialize(inlining: impl Inlining) -> AParseResult<Self::A> {
|
||||||
|
@ -27,7 +27,7 @@ pub trait StaticPairSerializable {
|
|||||||
/// for clarity and [`StaticPair`]'s simpler implementation
|
/// for clarity and [`StaticPair`]'s simpler implementation
|
||||||
/// at the cost of having to specify two extra fields.
|
/// at the cost of having to specify two extra fields.
|
||||||
///
|
///
|
||||||
/// Note: [`StaticPair::FA`] requires [`InlineableFactory`] be implemented.
|
/// Note: [`StaticPair::FA`] requires [`InliningFactory`] be implemented.
|
||||||
pub trait StaticPair<'a, Ctx: Context<'a>>:
|
pub trait StaticPair<'a, Ctx: Context<'a>>:
|
||||||
'a + StaticPairSerializable<SA = Self::A, SB = Self::B>
|
'a + StaticPairSerializable<SA = Self::A, SB = Self::B>
|
||||||
{
|
{
|
||||||
@ -38,7 +38,7 @@ pub trait StaticPair<'a, Ctx: Context<'a>>:
|
|||||||
/// Second element's type. Must equal [`StaticPairSerializable::SB`].
|
/// Second element's type. Must equal [`StaticPairSerializable::SB`].
|
||||||
type B: MentionableBase<'a, Ctx, Fctr = Self::FB>;
|
type B: MentionableBase<'a, Ctx, Fctr = Self::FB>;
|
||||||
/// First element's factory.
|
/// First element's factory.
|
||||||
type FA: FactoryBase<'a, Ctx, Mtbl = Self::A> + InlineableFactory<'a, Ctx>;
|
type FA: FactoryBase<'a, Ctx, Mtbl = Self::A> + InliningFactory<'a, Ctx>;
|
||||||
/// Second element's factory.
|
/// Second element's factory.
|
||||||
type FB: FactoryBase<'a, Ctx, Mtbl = Self::B> + ParseMode;
|
type FB: FactoryBase<'a, Ctx, Mtbl = Self::B> + ParseMode;
|
||||||
/// See [`FactoryBase::ParseError`].
|
/// See [`FactoryBase::ParseError`].
|
||||||
@ -172,10 +172,10 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, SP: StaticPair<'a, Ctx>> InlineableFactory<'a, Ctx>
|
impl<'a, Ctx: Context<'a>, SP: StaticPair<'a, Ctx>> InliningFactory<'a, Ctx>
|
||||||
for StaticPairFactory<'a, Ctx, SP>
|
for StaticPairFactory<'a, Ctx, SP>
|
||||||
where
|
where
|
||||||
SP::FB: InlineableFactory<'a, Ctx>,
|
SP::FB: InliningFactory<'a, Ctx>,
|
||||||
{
|
{
|
||||||
fn extension_error(&self, tail: &[u8]) -> Self::ParseError {
|
fn extension_error(&self, tail: &[u8]) -> Self::ParseError {
|
||||||
let (_, fb) = SP::factories(&self.factory_data);
|
let (_, fb) = SP::factories(&self.factory_data);
|
||||||
|
@ -107,7 +107,7 @@ impl<'a, Ctx: Context<'a>, A: MentionableBase<'a, Ctx>> Clone for Nullable<'a, C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, F: FactoryBase<'a, Ctx>> InlineableFactory<'a, Ctx>
|
impl<'a, Ctx: Context<'a>, F: FactoryBase<'a, Ctx>> InliningFactory<'a, Ctx>
|
||||||
for NullableFactory<F>
|
for NullableFactory<F>
|
||||||
{
|
{
|
||||||
fn extension_error(&self, tail: &[u8]) -> Self::ParseError {
|
fn extension_error(&self, tail: &[u8]) -> Self::ParseError {
|
||||||
|
@ -83,7 +83,7 @@ impl<F> ParseMode for PointFactory<F> {
|
|||||||
type Mode = InliningMode;
|
type Mode = InliningMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: Context<'a>, F: FactoryBase<'a, Ctx>> InlineableFactory<'a, Ctx> for PointFactory<F> {
|
impl<'a, Ctx: Context<'a>, F: FactoryBase<'a, Ctx>> InliningFactory<'a, Ctx> for PointFactory<F> {
|
||||||
fn extension_error(&self, tail: &[u8]) -> Self::ParseError {
|
fn extension_error(&self, tail: &[u8]) -> Self::ParseError {
|
||||||
PointParseError::WrongLength(HASH_SIZE + tail.len())
|
PointParseError::WrongLength(HASH_SIZE + tail.len())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user