From 2b6b3ca547753cdfa8c1755a85368780442aed34 Mon Sep 17 00:00:00 2001 From: timofey Date: Sun, 3 Sep 2023 20:12:58 +0000 Subject: [PATCH] `topology` -> `topology_hash` --- src/atomic.rs | 4 ++-- src/rcore/point.rs | 2 +- src/rcore/points.rs | 2 +- src/rcore/resolution.rs | 2 +- src/rcore/topology.rs | 2 +- src/rstd/atomic_object.rs | 2 +- src/rstd/local_origin.rs | 2 +- src/rstd/point.rs | 2 +- src/rstd/typeless.rs | 6 +++--- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/atomic.rs b/src/atomic.rs index 23a625a..6ae0469 100644 --- a/src/atomic.rs +++ b/src/atomic.rs @@ -37,13 +37,13 @@ pub trait AtomicBase: 'static + Send + Sync + Clone + Serializable { } /// This trait combines functionality of [`Mentionable`] and [`Factory`], -/// while limiting [`MentionableTop::points_typed`] (and corresponding [`MentionableTop::topology`]) +/// while limiting [`MentionableTop::points_typed`] (and corresponding [`MentionableTop::topology_hash`]) /// to an empty sequence. /// /// [`Mentionable`]: crate::rcore::Mentionable /// [`Factory`]: crate::rcore::Factory /// [`MentionableTop::points_typed`]: crate::rcore::MentionableTop::points_typed -/// [`MentionableTop::topology`]: crate::rcore::MentionableTop::topology +/// [`MentionableTop::topology_hash`]: crate::rcore::MentionableTop::topology_hash pub trait Atomic: AtomicModeParse { /// Static equivalent of [`FactoryParse::deserialize`]. /// diff --git a/src/rcore/point.rs b/src/rcore/point.rs index 55e329d..a210e2c 100644 --- a/src/rcore/point.rs +++ b/src/rcore/point.rs @@ -4,7 +4,7 @@ use super::*; pub struct Point<'a, Ctx: Context<'a>, A: MentionableBase<'a>> { /// Hash of the referred content. /// Derived both from the serialised value ([`Serializable::serialize`]) - /// and its topology ([`MentionableTop::topology`]). + /// and its topology ([`MentionableTop::topology_hash`]). pub point: Hash, /// [Origin] used in [`Point::resolve`]. pub origin: Arc>, diff --git a/src/rcore/points.rs b/src/rcore/points.rs index 8d8c962..a793239 100644 --- a/src/rcore/points.rs +++ b/src/rcore/points.rs @@ -7,7 +7,7 @@ pub trait PointsVisitor<'a, Ctx: Context<'a>> { } impl<'a, Ctx: Context<'a>> PointsVisitor<'a, Ctx> for Vec { - /// The only natural implementation, as used in [`MentionableTop::topology`]. + /// The only natural implementation, as used in [`MentionableTop::topology_hash`]. fn visit>(&mut self, point: &Point<'a, Ctx, A>) { self.extend(point.point) } diff --git a/src/rcore/resolution.rs b/src/rcore/resolution.rs index 1f195db..43a5360 100644 --- a/src/rcore/resolution.rs +++ b/src/rcore/resolution.rs @@ -50,7 +50,7 @@ pub struct Address { /// Trait representing the "rainbow table" behaviour. pub trait Resolver<'a, Ctx: Context<'a>>: 'a + Send + Sync { /// Successfully returned value should be the inverse of the point passed - /// with topology header ([`MentionableTop::topology()`]) omitted. + /// with topology header ([`MentionableTop::topology_hash()`]) omitted. fn resolve(self: Arc, address: Address) -> HashResolution<'a, Ctx>; } diff --git a/src/rcore/topology.rs b/src/rcore/topology.rs index a126a51..8f506f7 100644 --- a/src/rcore/topology.rs +++ b/src/rcore/topology.rs @@ -5,7 +5,7 @@ pub trait MentionableTop<'a, Ctx: Context<'a>>: 'a { /// See implementation for the definition. /// Hash of all the references' points concatenated, ordered, non-unique. /// Used for walking over object trees to ensure two objects with different references don't collide. - fn topology(&self) -> Hash + fn topology_hash(&self) -> Hash where Self: Mentionable<'a, Ctx>, { diff --git a/src/rstd/atomic_object.rs b/src/rstd/atomic_object.rs index b2c2421..36f006c 100644 --- a/src/rstd/atomic_object.rs +++ b/src/rstd/atomic_object.rs @@ -47,7 +47,7 @@ impl<'a, A: AtomicBase> MentionableBase<'a> for AtomicObject { } impl<'a, Ctx: Context<'a>, A: AtomicBase> MentionableTop<'a, Ctx> for AtomicObject { - fn topology(&self) -> Hash { + fn topology_hash(&self) -> Hash { Ctx::hash(b"") } diff --git a/src/rstd/local_origin.rs b/src/rstd/local_origin.rs index 280bf60..e90e057 100644 --- a/src/rstd/local_origin.rs +++ b/src/rstd/local_origin.rs @@ -8,7 +8,7 @@ use super::*; impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> Point<'a, Ctx, A> { fn prepare_bytes_for_hashing(mentioned: &A) -> Vec { - let mut vec = mentioned.topology().to_vec(); + let mut vec = mentioned.topology_hash().to_vec(); mentioned.serialize(&mut vec); vec } diff --git a/src/rstd/point.rs b/src/rstd/point.rs index 4fd974e..d42d813 100644 --- a/src/rstd/point.rs +++ b/src/rstd/point.rs @@ -31,7 +31,7 @@ impl PointFactory { } impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx>> MentionableTop<'a, Ctx> for Point<'a, Ctx, A> { - fn topology(&self) -> Hash { + fn topology_hash(&self) -> Hash { Ctx::hash(&self.point) } diff --git a/src/rstd/typeless.rs b/src/rstd/typeless.rs index be68285..cd22455 100644 --- a/src/rstd/typeless.rs +++ b/src/rstd/typeless.rs @@ -60,7 +60,7 @@ impl<'a, Ctx: Context<'a>> MentionableBase<'a> for TypelessMentionable<'a, Ctx> } impl<'a, Ctx: Context<'a>> MentionableTop<'a, Ctx> for TypelessMentionable<'a, Ctx> { - fn topology(&self) -> Hash { + fn topology_hash(&self) -> Hash { self.t_topology } @@ -115,7 +115,7 @@ impl<'a, Ctx: Context<'a>> CRegularFactory<'a, Ctx> for TypelessFactory<'a, Ctx> impl<'a, Ctx: SingularCtx<'a>> TypelessMentionable<'a, Ctx> { pub fn from_typed>(mentionable: Arc) -> Self { let factory = TypelessFactory::from_typed(mentionable.factory()); - let topology = mentionable.topology(); + let topology = mentionable.topology_hash(); let points = mentionable.points_vec(); TypelessMentionable { t_serialize: Box::new(move |serializer| mentionable.serialize(serializer)), @@ -197,7 +197,7 @@ impl<'a, Ctx: SingularCtx<'a>, A: Mentionable<'a, Ctx>> Point<'a, Ctx, A> { pub trait MentionableExt<'a, Ctx: Context<'a>>: Mentionable<'a, Ctx> { /// References ([Point]s) to other objects. Typeless. fn points_typeless(&self, points: &mut Vec>>); - /// [Vec] of [Point]s as used by [`MentionableTop::topology`]. + /// [Vec] of [Point]s as used by [`MentionableTop::topology_hash`]. fn points_vec(&self) -> Vec>>; }