reduce leading underscores
This commit is contained in:
parent
5cccad7022
commit
c32c83de4f
@ -56,7 +56,7 @@ pub trait Atomic: AtomicModeParse {
|
||||
fn a_extend(self, tail: &[u8]) -> AParseResult<Self>;
|
||||
}
|
||||
|
||||
fn _parse_slice<A: Atomic>(slice: &[u8]) -> AParseResult<A> {
|
||||
fn parse_slice<A: Atomic>(slice: &[u8]) -> AParseResult<A> {
|
||||
let mut deserializer = SliceDeserializer::from(slice);
|
||||
let atomic = A::a_deserialize(&mut deserializer)?;
|
||||
let tail = deserializer.read_all();
|
||||
@ -73,7 +73,7 @@ pub trait AtomicExt: Atomic {
|
||||
///
|
||||
/// [`FactoryExt::parse_slice`]: crate::rcore::FactoryExt::parse_slice
|
||||
fn parse_slice(slice: &[u8]) -> AParseResult<Self> {
|
||||
_parse_slice(slice)
|
||||
parse_slice(slice)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,59 +6,59 @@ type Frwa<'a, A, E0, E1, Fallible> =
|
||||
type Wwa<'a, A, E0, E1, Fallible> = WrapE<'a, WrapE<'a, A, E0, Fallible>, E1, Fallible>;
|
||||
|
||||
trait SpeculativeFailImpl<'a>: MonadFailAny<'a> {
|
||||
fn _speculative_a_wb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
|
||||
fn speculative_a_wb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
|
||||
a: A,
|
||||
wb: WrapE<'a, B, E0, Self>,
|
||||
) -> WrapE<'a, (A, B), Result<E0, E1>, Self> {
|
||||
Self::map_err(<Self::W<E0> as Functor>::fmap(wb, |b| (a, b)), Ok)
|
||||
}
|
||||
|
||||
fn _speculative_ra_wb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
|
||||
fn speculative_ra_wb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
|
||||
ra: Result<A, E0>,
|
||||
wb: WrapE<'a, B, E0, Self>,
|
||||
) -> WrapE<'a, (A, B), Result<E0, E1>, Self> {
|
||||
match ra {
|
||||
Ok(a) => Self::_speculative_a_wb(a, wb),
|
||||
Ok(a) => Self::speculative_a_wb(a, wb),
|
||||
Err(e0) => Self::fail(Ok(e0)),
|
||||
}
|
||||
}
|
||||
|
||||
fn _speculative_ra_rwb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
|
||||
fn speculative_ra_rwb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
|
||||
ra: Result<A, E0>,
|
||||
rwb: Result<WrapE<'a, B, E0, Self>, E1>,
|
||||
) -> WrapE<'a, (A, B), Result<E0, E1>, Self> {
|
||||
match rwb {
|
||||
Ok(wb) => Self::_speculative_ra_wb(ra, wb),
|
||||
Ok(wb) => Self::speculative_ra_wb(ra, wb),
|
||||
Err(e1) => Self::fail(Err(e1)),
|
||||
}
|
||||
}
|
||||
|
||||
fn _speculative_ra_frwb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
|
||||
fn speculative_ra_frwb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
|
||||
ra: Result<A, E0>,
|
||||
frwb: Frwa<'a, B, E0, E1, Self>,
|
||||
) -> WrapE<'a, (A, B), Result<E0, E1>, Self> {
|
||||
Self::stuff(<Self::T as Monad>::bind(frwb, |rwb| {
|
||||
Self::unstuff(Self::_speculative_ra_rwb(ra, rwb))
|
||||
Self::unstuff(Self::speculative_ra_rwb(ra, rwb))
|
||||
}))
|
||||
}
|
||||
|
||||
fn _speculative_fra_wb<A: 'a + Send, B: 'a + Send, E0: 'a + Send>(
|
||||
fn speculative_fra_wb<A: 'a + Send, B: 'a + Send, E0: 'a + Send>(
|
||||
fra: Wrap<'a, Result<A, E0>, Self::T>,
|
||||
wb: WrapE<'a, B, E0, Self>,
|
||||
) -> WrapE<'a, (A, B), E0, Self> {
|
||||
<Self::W<E0> as ApplicativeTuple>::tuple((Self::stuff(fra), wb))
|
||||
}
|
||||
|
||||
fn _speculative_wa_frwb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
|
||||
fn speculative_wa_frwb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
|
||||
wa: WrapE<'a, A, E0, Self>,
|
||||
frwb: Frwa<'a, B, E0, E1, Self>,
|
||||
) -> WrapE<'a, (A, B), Result<E0, E1>, Self> {
|
||||
Self::stuff(<<Self as MonadFailAny>::T as Monad>::join(
|
||||
<<Self as MonadFailAny>::T as Functor>::fmap(
|
||||
Self::T::select_map(Self::unstuff(wa), frwb, |selected| match selected {
|
||||
Selected::A(ra, frwb) => Self::_speculative_ra_frwb(ra, frwb),
|
||||
Selected::A(ra, frwb) => Self::speculative_ra_frwb(ra, frwb),
|
||||
Selected::B(fra, Ok(wb)) => {
|
||||
Self::map_err(Self::_speculative_fra_wb(fra, wb), Ok)
|
||||
Self::map_err(Self::speculative_fra_wb(fra, wb), Ok)
|
||||
}
|
||||
Selected::B(_, Err(e1)) => Self::fail(Err(e1)),
|
||||
}),
|
||||
@ -67,17 +67,16 @@ trait SpeculativeFailImpl<'a>: MonadFailAny<'a> {
|
||||
))
|
||||
}
|
||||
|
||||
fn _speculative_frwa_wb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
|
||||
fn speculative_frwa_wb<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
|
||||
frwa: Frwa<'a, A, E0, E1, Self>,
|
||||
wb: WrapE<'a, B, E0, Self>,
|
||||
) -> WrapE<'a, (A, B), Result<E0, E1>, Self> {
|
||||
<Self::W<Result<E0, E1>> as Functor>::fmap(
|
||||
Self::_speculative_wa_frwb(wb, frwa),
|
||||
|(b, a)| (a, b),
|
||||
)
|
||||
<Self::W<Result<E0, E1>> as Functor>::fmap(Self::speculative_wa_frwb(wb, frwa), |(b, a)| {
|
||||
(a, b)
|
||||
})
|
||||
}
|
||||
|
||||
fn _speculative<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
|
||||
fn speculative_impl<A: 'a + Send, B: 'a + Send, E0: 'a + Send, E1: 'a + Send>(
|
||||
wwa: Wwa<'a, A, E0, E1, Self>,
|
||||
wwb: Wwa<'a, B, E0, E1, Self>,
|
||||
) -> WrapE<'a, (A, B), Result<E0, E1>, Self> {
|
||||
@ -86,9 +85,9 @@ trait SpeculativeFailImpl<'a>: MonadFailAny<'a> {
|
||||
Self::unstuff(wwa),
|
||||
Self::unstuff(wwb),
|
||||
|selected| match selected {
|
||||
Selected::A(Ok(wa), frwb) => Self::_speculative_wa_frwb(wa, frwb),
|
||||
Selected::A(Ok(wa), frwb) => Self::speculative_wa_frwb(wa, frwb),
|
||||
Selected::A(Err(e1), _) => Self::fail(Err(e1)),
|
||||
Selected::B(frwa, Ok(wb)) => Self::_speculative_frwa_wb(frwa, wb),
|
||||
Selected::B(frwa, Ok(wb)) => Self::speculative_frwa_wb(frwa, wb),
|
||||
Selected::B(_, Err(e1)) => Self::fail(Err(e1)),
|
||||
},
|
||||
),
|
||||
@ -102,7 +101,7 @@ pub trait SpeculativeFail<'a>: MonadFailAny<'a> {
|
||||
wwa: Wwa<'a, A, E0, E1, Self>,
|
||||
wwb: Wwa<'a, B, E0, E1, Self>,
|
||||
) -> WrapE<'a, (A, B), Result<E0, E1>, Self> {
|
||||
Self::_speculative(wwa, wwb)
|
||||
Self::speculative_impl(wwa, wwb)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ pub fn bind<'a, T: Monad<'a>, A: 'a + Send, B: 'a + Send>(
|
||||
}
|
||||
|
||||
pub trait ApplicativeLA2ViaSeq<'a>: ApplicativeSeq<'a> {
|
||||
fn _la2_via_seq<A: 'a + Send, B: 'a + Send, C: 'a + Send>(
|
||||
fn la2_via_seq<A: 'a + Send, B: 'a + Send, C: 'a + Send>(
|
||||
f: impl 'a + Send + FnOnce(A, B) -> C,
|
||||
fa: Self::F<A>,
|
||||
fb: Self::F<B>,
|
||||
@ -29,7 +29,7 @@ pub trait ApplicativeLA2ViaSeq<'a>: ApplicativeSeq<'a> {
|
||||
impl<'a, T: ApplicativeSeq<'a>> ApplicativeLA2ViaSeq<'a> for T {}
|
||||
|
||||
pub trait ApplicativeSeqViaLA2<'a>: ApplicativeLA2<'a> {
|
||||
fn _seq_via_la2<A: 'a + Send, B: 'a + Send>(
|
||||
fn seq_via_la2<A: 'a + Send, B: 'a + Send>(
|
||||
ff: Self::F<impl 'a + Send + FnOnce(A) -> B>,
|
||||
fa: Self::F<A>,
|
||||
) -> Self::F<B> {
|
||||
@ -40,7 +40,7 @@ pub trait ApplicativeSeqViaLA2<'a>: ApplicativeLA2<'a> {
|
||||
impl<'a, T: ApplicativeLA2<'a>> ApplicativeSeqViaLA2<'a> for T {}
|
||||
|
||||
pub trait ApplicativeTupleViaLA2<'a>: ApplicativeLA2<'a> {
|
||||
fn _tuple_via_la2<A: 'a + Send, B: 'a + Send>(
|
||||
fn tuple_via_la2<A: 'a + Send, B: 'a + Send>(
|
||||
(fa, fb): (Self::F<A>, Self::F<B>),
|
||||
) -> Self::F<(A, B)> {
|
||||
Self::la2(fa, fb, |a, b| (a, b))
|
||||
|
@ -59,7 +59,7 @@ impl Atom for Temp {
|
||||
}
|
||||
|
||||
impl<'a> EvalTree<'a> {
|
||||
fn _next_composite(mut self: Box<Self>, other: Box<Self>) -> Self {
|
||||
fn next_composite(mut self: Box<Self>, other: Box<Self>) -> Self {
|
||||
match *self {
|
||||
Self::Atom(f) => match f.next() {
|
||||
Some(newleft) => {
|
||||
@ -78,7 +78,7 @@ impl<'a> EvalTree<'a> {
|
||||
fn next(self) -> Oet<'a> {
|
||||
match self {
|
||||
Self::Atom(f) => f.next(),
|
||||
Self::Composite(etl, etr) => Some(etl._next_composite(etr)),
|
||||
Self::Composite(etl, etr) => Some(etl.next_composite(etr)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -239,13 +239,13 @@ impl<'a> ApplicativeLA2<'a> for StacklessInstance {
|
||||
fb: Self::F<B>,
|
||||
f: impl 'a + Send + FnOnce(A, B) -> C,
|
||||
) -> Self::F<C> {
|
||||
Self::_la2_via_seq(f, fa, fb)
|
||||
Self::la2_via_seq(f, fa, fb)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ApplicativeTuple<'a> for StacklessInstance {
|
||||
fn tuple<A: 'a + Send, B: 'a + Send>((fa, fb): (Self::F<A>, Self::F<B>)) -> Self::F<(A, B)> {
|
||||
Self::_tuple_via_la2((fa, fb))
|
||||
Self::tuple_via_la2((fa, fb))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ pub(super) trait InliningAddresses<E>: Stream {
|
||||
|
||||
impl<E, D: ?Sized + Stream> InliningAddresses<E> for D {}
|
||||
|
||||
fn _parse_slice<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>>(
|
||||
fn parse_slice<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>>(
|
||||
factory: &F,
|
||||
slice: &[u8],
|
||||
resolver: &Arc<dyn Resolver<'a, Ctx>>,
|
||||
@ -83,7 +83,7 @@ impl<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>> FactoryExt<'a, Ctx> for F {
|
||||
slice: &[u8],
|
||||
resolver: &Arc<dyn Resolver<'a, Ctx>>,
|
||||
) -> ParseResult<'a, Self> {
|
||||
_parse_slice::<Ctx, _>(self, slice, resolver)
|
||||
parse_slice::<Ctx, _>(self, slice, resolver)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ struct ResolverOrigin<'a, Ctx: Context<'a>, F: FactoryBase<'a>> {
|
||||
r_resolver: Arc<dyn Resolver<'a, Ctx>>,
|
||||
}
|
||||
|
||||
fn _resolve_origin<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>>(
|
||||
fn resolve_origin<'a, Ctx: Context<'a>, F: FactoryParse<'a, Ctx>>(
|
||||
origin: Arc<ResolverOrigin<'a, Ctx, F>>,
|
||||
) -> Resolution<'a, Ctx, F::Mtbl> {
|
||||
origin
|
||||
@ -51,7 +51,7 @@ impl<'a, Ctx: Context<'a>, F: FactoryBase<'a>> Origin<'a, Ctx> for ResolverOrigi
|
||||
where
|
||||
F: FactoryParse<'a, Ctx>,
|
||||
{
|
||||
_resolve_origin(self)
|
||||
resolve_origin(self)
|
||||
}
|
||||
|
||||
fn resolve_bytes(self: Arc<Self>) -> HashResolution<'a, Ctx> {
|
||||
|
@ -87,7 +87,7 @@ impl<'a, Ctx: CastCtx<'a>> CastResolver<'a, Ctx> {
|
||||
Arc::new(Self { points })
|
||||
}
|
||||
|
||||
fn _get_point(
|
||||
fn get_point_impl(
|
||||
&self,
|
||||
index: usize,
|
||||
) -> Result<&Point<'a, Ctx, TypelessMentionable<'a, Ctx>>, CastError<'a>> {
|
||||
@ -100,7 +100,7 @@ impl<'a, Ctx: CastCtx<'a>> CastResolver<'a, Ctx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _validate_point(
|
||||
fn validate_point(
|
||||
&self,
|
||||
point: &Point<'a, Ctx, TypelessMentionable<'a, Ctx>>,
|
||||
address: Address,
|
||||
@ -120,8 +120,8 @@ impl<'a, Ctx: CastCtx<'a>> CastResolver<'a, Ctx> {
|
||||
&self,
|
||||
address: Address,
|
||||
) -> Result<&Point<'a, Ctx, TypelessMentionable<'a, Ctx>>, CastError<'a>> {
|
||||
let point = self._get_point(address.index)?;
|
||||
self._validate_point(point, address)?;
|
||||
let point = self.get_point_impl(address.index)?;
|
||||
self.validate_point(point, address)?;
|
||||
Ok(point)
|
||||
}
|
||||
}
|
||||
|
@ -178,30 +178,30 @@ impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx> + FixedSizeObject<'a, Ctx>>
|
||||
/// whether some other type (for example, a generic parameter type)
|
||||
/// is fixed-size or not.
|
||||
pub trait AlwaysFixedSize {
|
||||
fn _size(&self) -> usize;
|
||||
fn asize(&self) -> usize;
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, F: AlwaysFixedSize + InliningFactory<'a, Ctx>> FixedSizeFactory<'a, Ctx>
|
||||
for F
|
||||
{
|
||||
fn size(&self) -> usize {
|
||||
self._size()
|
||||
self.asize()
|
||||
}
|
||||
}
|
||||
|
||||
/// Compile-time analogue of [`AlwaysFixedSize`].
|
||||
pub trait AlwaysConstSize {
|
||||
const _SIZE: usize;
|
||||
const ASIZE: usize;
|
||||
}
|
||||
|
||||
impl<F: AlwaysConstSize> AlwaysFixedSize for F {
|
||||
fn _size(&self) -> usize {
|
||||
Self::_SIZE
|
||||
fn asize(&self) -> usize {
|
||||
Self::ASIZE
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, F: AlwaysConstSize + InliningFactory<'a, Ctx>> ConstSizeFactory<'a, Ctx>
|
||||
for F
|
||||
{
|
||||
const SIZE: usize = Self::_SIZE;
|
||||
const SIZE: usize = Self::ASIZE;
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ impl<'a, Ctx: Context<'a>, F: FactoryBase<'a>> CInliningFactory<'a, Ctx>
|
||||
}
|
||||
|
||||
impl<Ctx, F> AlwaysConstSize for NullableFactory<Ctx, F> {
|
||||
const _SIZE: usize = HASH_SIZE;
|
||||
const ASIZE: usize = HASH_SIZE;
|
||||
}
|
||||
|
||||
impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> From<Arc<A>> for Nullable<'a, Ctx, A> {
|
||||
|
@ -107,5 +107,5 @@ impl<'a, Ctx: Context<'a>, F: FactoryBase<'a>> CInliningFactory<'a, Ctx> for Poi
|
||||
}
|
||||
|
||||
impl<Ctx, F> AlwaysConstSize for PointFactory<Ctx, F> {
|
||||
const _SIZE: usize = HASH_SIZE;
|
||||
const ASIZE: usize = HASH_SIZE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user