remove Addresses::next_point

This commit is contained in:
AF 2023-07-01 00:13:02 +00:00
parent e97af875cb
commit f326b8385d
3 changed files with 5 additions and 19 deletions

View File

@ -22,7 +22,7 @@ use std::{error::Error, rc::Rc};
use crate::func::context::*; use crate::func::context::*;
use crate::func::*; use crate::func::*;
pub use self::addresses::{Addresses, InliningAddresses}; use self::addresses::{Addresses, InliningAddresses};
pub use self::context::Context; pub use self::context::Context;
use self::dectx::{DeCtx, DeCtxT}; use self::dectx::{DeCtx, DeCtxT};
pub use self::diagnostic::Diagnostic; pub use self::diagnostic::Diagnostic;

View File

@ -1,7 +1,7 @@
use super::*; use super::*;
/// Preferred way to parse [Point]s off of a [Serializer]. /// Preferred way to parse [Point]s off of a [Serializer].
pub struct Addresses { pub(super) struct Addresses {
current: usize, current: usize,
} }
@ -20,27 +20,13 @@ impl Addresses {
Ok(address) Ok(address)
} }
/// Read the next [Point].
pub fn next_point<'a, 'b, Ctx: Context<'a>, A: Mentionable<'a, Ctx>>(
&mut self,
deserializer: &'b mut dyn Deserializer,
resolver: Rc<dyn Resolver<'a, Ctx>>,
factory: A::Fctr,
) -> Result<Point<'a, Ctx, A>, &'b [u8]> {
Ok(Point::from_address(
self.next(deserializer)?,
factory,
resolver,
))
}
/// Start reading the [Address]es. /// Start reading the [Address]es.
fn start() -> Self { fn start() -> Self {
Addresses { current: 0 } Addresses { current: 0 }
} }
} }
pub trait InliningAddresses<E>: Inlining { pub(super) trait InliningAddresses<E>: Inlining {
fn inext_address( fn inext_address(
self, self,
addresses: &mut Addresses, addresses: &mut Addresses,

View File

@ -2,10 +2,10 @@ use super::*;
/// [Inlining] context. /// [Inlining] context.
pub trait InCtx<'a, Ctx: Context<'a>>: Inlining { pub trait InCtx<'a, Ctx: Context<'a>>: Inlining {
/// [Inlining] equivalent for [`Addresses::next`]. /// Read the next [Address].
fn icnext_address<E>(self, err: impl FnOnce(&[u8]) -> E) -> Result<(Address, Self), E>; fn icnext_address<E>(self, err: impl FnOnce(&[u8]) -> E) -> Result<(Address, Self), E>;
/// [Inlining] equivalent for [`Addresses::next_point`]. /// Read the next [Point].
fn icnext_point<'b, A: Mentionable<'a, Ctx>, E>( fn icnext_point<'b, A: Mentionable<'a, Ctx>, E>(
self, self,
factory: A::Fctr, factory: A::Fctr,