From 4425b4c545c040022f1d8e67e12ef40d3759723b Mon Sep 17 00:00:00 2001 From: timofey Date: Sat, 1 Jul 2023 14:45:01 +0000 Subject: [PATCH] `TakesPoints` -> `PointsVisitor` --- src/rcore.rs | 4 ++-- src/rcore/points.rs | 8 ++++---- src/rstd/atomic/atomic_object.rs | 2 +- src/rstd/collections/stack.rs | 2 +- src/rstd/collections/tree.rs | 4 ++-- src/rstd/inlining/static_pair.rs | 2 +- src/rstd/nullable.rs | 4 ++-- src/rstd/point.rs | 4 ++-- src/rstd/singular.rs | 4 ++-- src/rstd/typeless.rs | 8 ++++---- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/rcore.rs b/src/rcore.rs index 33c0f89..4cc9eef 100644 --- a/src/rcore.rs +++ b/src/rcore.rs @@ -33,7 +33,7 @@ pub use self::inctx::InCtx; pub use self::inlining::{Inlining, InliningExt, InliningResultExt}; pub use self::origin::{OFctr, Origin}; pub use self::point::Point; -pub use self::points::TakesPoints; +pub use self::points::PointsVisitor; pub use self::resolution::{ Address, HashResolution, HashResolutionResult, LookupError, Resolution, ResolutionError, ResolutionFailure, ResolutionResult, Resolver, ResolverMap, @@ -60,7 +60,7 @@ pub trait Mentionable<'a, Ctx: Context<'a>>: 'a + Serializable { Ctx::hash(&vec) } /// References ([Point]s) to other objects. Typed. - fn points_typed(&self, points: &mut impl TakesPoints<'a, Ctx>); + fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>); } /// [`Factory`] associated with the [`Mentionable`]. Mostly useful for `type` definitions. diff --git a/src/rcore/points.rs b/src/rcore/points.rs index e532739..cc5108b 100644 --- a/src/rcore/points.rs +++ b/src/rcore/points.rs @@ -1,14 +1,14 @@ use super::*; /// Visitor used in [`Mentionable::points_typed`]. -pub trait TakesPoints<'a, Ctx: Context<'a>> { +pub trait PointsVisitor<'a, Ctx: Context<'a>> { /// Visit a [Point]. - fn take>(&mut self, point: &Point<'a, Ctx, A>); + fn visit>(&mut self, point: &Point<'a, Ctx, A>); } -impl<'a, Ctx: Context<'a>> TakesPoints<'a, Ctx> for Vec { +impl<'a, Ctx: Context<'a>> PointsVisitor<'a, Ctx> for Vec { /// The only natural implementation, as used in [`Mentionable::topology`]. - fn take>(&mut self, point: &Point<'a, Ctx, A>) { + fn visit>(&mut self, point: &Point<'a, Ctx, A>) { self.extend(point.point) } } diff --git a/src/rstd/atomic/atomic_object.rs b/src/rstd/atomic/atomic_object.rs index 74af041..f55f913 100644 --- a/src/rstd/atomic/atomic_object.rs +++ b/src/rstd/atomic/atomic_object.rs @@ -47,7 +47,7 @@ impl<'a, Ctx: Context<'a>, A: Atomic> Mentionable<'a, Ctx> for AtomicObject { Ctx::hash(b"") } - fn points_typed(&self, _points: &mut impl TakesPoints<'a, Ctx>) {} + fn points_typed(&self, _points: &mut impl PointsVisitor<'a, Ctx>) {} } /// Generic implementation of a [Factory] for [Atomic]s. diff --git a/src/rstd/collections/stack.rs b/src/rstd/collections/stack.rs index 61f536b..ca886a2 100644 --- a/src/rstd/collections/stack.rs +++ b/src/rstd/collections/stack.rs @@ -42,7 +42,7 @@ impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> Mentionable<'a, Ctx> for Sta StackNodeFactory::new(self.element.factory()) } - fn points_typed(&self, points: &mut impl TakesPoints<'a, Ctx>) { + fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>) { self.rest.points_typed(points); self.element.points_typed(points); } diff --git a/src/rstd/collections/tree.rs b/src/rstd/collections/tree.rs index da54f7c..186dc6e 100644 --- a/src/rstd/collections/tree.rs +++ b/src/rstd/collections/tree.rs @@ -112,7 +112,7 @@ impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> Mentionable<'a, Ctx> for Nod NodeFactory(self.key.factory()) } - fn points_typed(&self, points: &mut impl TakesPoints<'a, Ctx>) { + fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>) { self.l.points_typed(points); self.r.points_typed(points); self.key.points_typed(points); @@ -126,7 +126,7 @@ impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> Mentionable<'a, Ctx> for Tre TreeFactory(self.node.factory()) } - fn points_typed(&self, points: &mut impl TakesPoints<'a, Ctx>) { + fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>) { self.node.points_typed(points); } } diff --git a/src/rstd/inlining/static_pair.rs b/src/rstd/inlining/static_pair.rs index ab75a8c..f913320 100644 --- a/src/rstd/inlining/static_pair.rs +++ b/src/rstd/inlining/static_pair.rs @@ -109,7 +109,7 @@ impl<'a, Ctx: Context<'a>, SP: StaticPair<'a, Ctx>> Mentionable<'a, Ctx> for Sta } } - fn points_typed(&self, points: &mut impl TakesPoints<'a, Ctx>) { + fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>) { let (a, b) = self.pair.elements(); a.points_typed(points); b.points_typed(points); diff --git a/src/rstd/nullable.rs b/src/rstd/nullable.rs index 49835c8..0e6b459 100644 --- a/src/rstd/nullable.rs +++ b/src/rstd/nullable.rs @@ -42,10 +42,10 @@ impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> Mentionable<'a, Ctx> for Nul } } - fn points_typed(&self, points: &mut impl TakesPoints<'a, Ctx>) { + fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>) { match self { Self::Null(_) => {} - Self::NotNull(point) => points.take(point), + Self::NotNull(point) => points.visit(point), } } } diff --git a/src/rstd/point.rs b/src/rstd/point.rs index effd113..ad958ab 100644 --- a/src/rstd/point.rs +++ b/src/rstd/point.rs @@ -23,8 +23,8 @@ impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> Mentionable<'a, Ctx> for Poi Ctx::hash(&self.point) } - fn points_typed(&self, points: &mut impl TakesPoints<'a, Ctx>) { - points.take(self) + fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>) { + points.visit(self) } } diff --git a/src/rstd/singular.rs b/src/rstd/singular.rs index 495c136..30a7a04 100644 --- a/src/rstd/singular.rs +++ b/src/rstd/singular.rs @@ -52,8 +52,8 @@ impl<'a, Ctx: Context<'a>> Resolver<'a, Ctx> for SingularResolver<'a, Ctx> { } } -impl<'a, Ctx: Context<'a>> TakesPoints<'a, Ctx> for Vec>> { - fn take>(&mut self, point: &Point<'a, Ctx, A>) { +impl<'a, Ctx: Context<'a>> PointsVisitor<'a, Ctx> for Vec>> { + fn visit>(&mut self, point: &Point<'a, Ctx, A>) { self.push(Rc::new(point.clone()) as Rc>); } } diff --git a/src/rstd/typeless.rs b/src/rstd/typeless.rs index 176be55..16e2afd 100644 --- a/src/rstd/typeless.rs +++ b/src/rstd/typeless.rs @@ -59,9 +59,9 @@ impl<'a, Ctx: Context<'a>> Mentionable<'a, Ctx> for TypelessMentionable<'a, Ctx> self.t_topology } - fn points_typed(&self, points: &mut impl TakesPoints<'a, Ctx>) { + fn points_typed(&self, points: &mut impl PointsVisitor<'a, Ctx>) { for point in self.t_points.iter() { - points.take(point) + points.visit(point) } } } @@ -220,12 +220,12 @@ where } } -impl<'a, Ctx: Context<'a>> TakesPoints<'a, Ctx> +impl<'a, Ctx: Context<'a>> PointsVisitor<'a, Ctx> for Vec>> where Ctx::LookupError: From>, { - fn take>(&mut self, point: &Point<'a, Ctx, A>) { + fn visit>(&mut self, point: &Point<'a, Ctx, A>) { self.push(point.typeless()); } }