From 70f9941854733090e12833dfaa268581042bbe7f Mon Sep 17 00:00:00 2001 From: Emre Sahin Date: Wed, 18 Jan 2023 11:39:13 +0300 Subject: [PATCH] update docs --- ecs/src/ecs/mod.rs | 13 +++++-------- logging/CHANGELOG.md | 4 +++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ecs/src/ecs/mod.rs b/ecs/src/ecs/mod.rs index 1545e0fa4..0ae2b01a7 100755 --- a/ecs/src/ecs/mod.rs +++ b/ecs/src/ecs/mod.rs @@ -37,7 +37,7 @@ use crate::error::{Error as XvcError, Result}; /// Various types of information (components) can be attached to this entity. /// XvcStore uses the entity as a key for the components. /// -/// It's possible to convert to `(u64, u64)` back and forth. +/// It's possible to convert to `(u64, u64)` or `u128` back and forth. /// Normally, you should use [XvcEntityGenerator] to create entities. /// It randomizes the first value to be unique and saves the last number across sessions. /// This changed in 0.5. See https://github.com/iesahin/xvc/issues/198 @@ -84,7 +84,7 @@ impl From for (u64, u64) { #[derive(Debug)] pub struct XvcEntityGenerator { counter: AtomicU64, - init_random: u64, + random: u64, } static INIT: Once = Once::new(); @@ -132,16 +132,13 @@ impl XvcEntityGenerator { let init_random = rng.next_u64(); Self { counter, - init_random, + random: init_random, } } /// Returns the next element by atomically incresing the current value. pub fn next_element(&self) -> XvcEntity { - XvcEntity( - self.counter.fetch_add(1, Ordering::SeqCst), - self.init_random, - ) + XvcEntity(self.counter.fetch_add(1, Ordering::SeqCst), self.random) } fn load(dir: &Path) -> Result { @@ -159,7 +156,7 @@ impl XvcEntityGenerator { /// Saves the current XvcEntity counter to path. /// It saves only the first (e.0) part of the entity. The second part is - /// generated per invocation to randomize entities in parallel use. + /// generated per creation to randomize entities in parallel branches. pub fn save(&self, dir: &Path) -> Result<()> { let (counter, _) = self.next_element().into(); if !dir.exists() { diff --git a/logging/CHANGELOG.md b/logging/CHANGELOG.md index 6869ca433..bc09a0734 100644 --- a/logging/CHANGELOG.md +++ b/logging/CHANGELOG.md @@ -25,7 +25,9 @@ tree and subtasks are marked with indentation. and building the binary before the doc tests. - Now builds the binary before running the doc tests. ✅ - - Update the ECS documentation + - [x] Update the ECS documentation + - [x] Update arch/ecs.md + - [x] Search for any `XvcEntity` references that may be changed ## v0.4.2