From 59a03aaf526b87a5958b29751df1eb5cdf99f79f Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Fri, 19 Apr 2024 12:11:46 +0200 Subject: [PATCH] more unneeded Cached prefixes --- crates/re_entity_db/src/entity_db.rs | 6 +++--- crates/re_query/src/latest_at/helpers.rs | 16 ++++++++-------- crates/re_query/src/latest_at/mod.rs | 2 +- crates/re_query/src/lib.rs | 4 ++-- crates/re_query/src/range/mod.rs | 2 +- crates/re_query/src/range/results.rs | 14 +++++++------- .../src/visualizers/results_ext.rs | 10 +++++----- .../src/visualizer_system.rs | 4 ++-- .../src/visualizer_system.rs | 4 ++-- 9 files changed, 31 insertions(+), 31 deletions(-) diff --git a/crates/re_entity_db/src/entity_db.rs b/crates/re_entity_db/src/entity_db.rs index 9bf3eb4c3d5de..6a36b742ee007 100644 --- a/crates/re_entity_db/src/entity_db.rs +++ b/crates/re_entity_db/src/entity_db.rs @@ -240,7 +240,7 @@ impl EntityDb { &self, entity_path: &EntityPath, query: &re_data_store::LatestAtQuery, - ) -> Option> { + ) -> Option> { self.query_caches().latest_at_component::( self.store(), self.resolver(), @@ -254,7 +254,7 @@ impl EntityDb { &self, entity_path: &EntityPath, query: &re_data_store::LatestAtQuery, - ) -> Option> { + ) -> Option> { self.query_caches().latest_at_component_quiet::( self.store(), self.resolver(), @@ -268,7 +268,7 @@ impl EntityDb { &self, entity_path: &EntityPath, query: &re_data_store::LatestAtQuery, - ) -> Option<(EntityPath, re_query::CachedLatestAtMonoResult)> { + ) -> Option<(EntityPath, re_query::LatestAtMonoResult)> { self.query_caches() .latest_at_component_at_closest_ancestor::( self.store(), diff --git a/crates/re_query/src/latest_at/helpers.rs b/crates/re_query/src/latest_at/helpers.rs index a40aeed6400b7..3e0a300e175b0 100644 --- a/crates/re_query/src/latest_at/helpers.rs +++ b/crates/re_query/src/latest_at/helpers.rs @@ -241,12 +241,12 @@ impl LatestAtComponentResults { // --- #[derive(Clone)] -pub struct CachedLatestAtMonoResult { +pub struct LatestAtMonoResult { pub index: (TimeInt, RowId), pub value: C, } -impl CachedLatestAtMonoResult { +impl LatestAtMonoResult { #[inline] pub fn data_time(&self) -> TimeInt { self.index.0 @@ -258,7 +258,7 @@ impl CachedLatestAtMonoResult { } } -impl std::ops::Deref for CachedLatestAtMonoResult { +impl std::ops::Deref for LatestAtMonoResult { type Target = C; #[inline] @@ -287,7 +287,7 @@ impl Caches { entity_path: &EntityPath, query: &LatestAtQuery, level: re_log::Level, - ) -> Option> { + ) -> Option> { re_tracing::profile_function!(); let results = self.latest_at(store, query, entity_path, [C::name()]); @@ -303,7 +303,7 @@ impl Caches { ); None } - PromiseResult::Ready(data) if data.len() == 1 => Some(CachedLatestAtMonoResult { + PromiseResult::Ready(data) if data.len() == 1 => Some(LatestAtMonoResult { index, value: data[0].clone(), }), @@ -343,7 +343,7 @@ impl Caches { resolver: &PromiseResolver, entity_path: &EntityPath, query: &LatestAtQuery, - ) -> Option> { + ) -> Option> { self.latest_at_component_with_log_level( store, resolver, @@ -368,7 +368,7 @@ impl Caches { resolver: &PromiseResolver, entity_path: &EntityPath, query: &LatestAtQuery, - ) -> Option> { + ) -> Option> { self.latest_at_component_with_log_level( store, resolver, @@ -385,7 +385,7 @@ impl Caches { resolver: &PromiseResolver, entity_path: &EntityPath, query: &LatestAtQuery, - ) -> Option<(EntityPath, CachedLatestAtMonoResult)> { + ) -> Option<(EntityPath, LatestAtMonoResult)> { re_tracing::profile_function!(); let mut cur_entity_path = Some(entity_path.clone()); diff --git a/crates/re_query/src/latest_at/mod.rs b/crates/re_query/src/latest_at/mod.rs index dc14334710cff..04511f8312606 100644 --- a/crates/re_query/src/latest_at/mod.rs +++ b/crates/re_query/src/latest_at/mod.rs @@ -5,6 +5,6 @@ mod results; #[cfg(feature = "to_archetype")] mod to_archetype; -pub use self::helpers::CachedLatestAtMonoResult; +pub use self::helpers::LatestAtMonoResult; pub use self::query::LatestAtCache; pub use self::results::{LatestAtComponentResults, LatestAtResults}; diff --git a/crates/re_query/src/lib.rs b/crates/re_query/src/lib.rs index bb4fe77fea132..e95417b9dc5d2 100644 --- a/crates/re_query/src/lib.rs +++ b/crates/re_query/src/lib.rs @@ -19,8 +19,8 @@ pub use self::visible_history::{ExtraQueryHistory, VisibleHistory, VisibleHistor pub use self::cache::{CacheKey, Caches}; pub use self::cache_stats::{CachedComponentStats, CachesStats}; pub use self::flat_vec_deque::{ErasedFlatVecDeque, FlatVecDeque}; -pub use self::latest_at::{CachedLatestAtMonoResult, LatestAtComponentResults, LatestAtResults}; -pub use self::range::{CachedRangeData, RangeComponentResults, RangeResults}; +pub use self::latest_at::{LatestAtMonoResult, LatestAtComponentResults, LatestAtResults}; +pub use self::range::{RangeData, RangeComponentResults, RangeResults}; pub(crate) use self::latest_at::LatestAtCache; pub(crate) use self::range::{RangeCache, RangeComponentResultsInner}; diff --git a/crates/re_query/src/range/mod.rs b/crates/re_query/src/range/mod.rs index c373dc86d9b22..a4aadf6310cbb 100644 --- a/crates/re_query/src/range/mod.rs +++ b/crates/re_query/src/range/mod.rs @@ -3,6 +3,6 @@ mod results; pub use self::query::RangeCache; pub use self::results::{ - RangeComponentResults, RangeComponentResultsInner, CachedRangeData, + RangeComponentResults, RangeComponentResultsInner, RangeData, RangeResults, }; diff --git a/crates/re_query/src/range/results.rs b/crates/re_query/src/range/results.rs index 6ca26102b725a..6afdabeddce72 100644 --- a/crates/re_query/src/range/results.rs +++ b/crates/re_query/src/range/results.rs @@ -153,7 +153,7 @@ impl std::ops::Deref for RangeComponentResults { // TODO: I see no reason why we couldnt put the query range in there, simplifying the life of // downstream consumers. #[derive(Debug)] -pub struct CachedRangeData<'a, T> { +pub struct RangeData<'a, T> { // TODO(Amanieu/parking_lot#289): we need two distinct mapped guards because it's // impossible to return an owned type in a `parking_lot` guard. // See . @@ -171,7 +171,7 @@ pub struct CachedRangeData<'a, T> { reentering: &'static std::thread::LocalKey>, } -impl<'a, T> Drop for CachedRangeData<'a, T> { +impl<'a, T> Drop for RangeData<'a, T> { #[inline] fn drop(&mut self) { self.reentering @@ -179,7 +179,7 @@ impl<'a, T> Drop for CachedRangeData<'a, T> { } } -impl<'a, T> CachedRangeData<'a, T> { +impl<'a, T> RangeData<'a, T> { /// Returns the current status on both ends of the range. /// /// E.g. it is possible that the front-side of the range is still waiting for pending data while @@ -255,7 +255,7 @@ impl RangeComponentResults { /// Use [`PromiseResult::flatten`] to merge the results of resolving the promise and of /// deserializing the data into a single one, if you don't need the extra flexibility. #[inline] - pub fn to_dense(&self, resolver: &PromiseResolver) -> CachedRangeData<'_, C> { + pub fn to_dense(&self, resolver: &PromiseResolver) -> RangeData<'_, C> { // --- Step 1: try and upsert pending data (write lock) --- thread_local! { @@ -467,7 +467,7 @@ impl RangeComponentResults { .unwrap() }); - CachedRangeData { + RangeData { indices, data, time_range: self.time_range, @@ -490,7 +490,7 @@ impl RangeComponentResults { pub fn to_sparse( &self, resolver: &PromiseResolver, - ) -> CachedRangeData<'_, Option> { + ) -> RangeData<'_, Option> { // --- Step 1: try and upsert pending data (write lock) --- thread_local! { @@ -702,7 +702,7 @@ impl RangeComponentResults { .unwrap() }); - CachedRangeData { + RangeData { indices, data, time_range: self.time_range, diff --git a/crates/re_space_view_spatial/src/visualizers/results_ext.rs b/crates/re_space_view_spatial/src/visualizers/results_ext.rs index 3e90af1190050..96f45389738a1 100644 --- a/crates/re_space_view_spatial/src/visualizers/results_ext.rs +++ b/crates/re_space_view_spatial/src/visualizers/results_ext.rs @@ -1,4 +1,4 @@ -use re_query::{CachedRangeData, LatestAtResults, PromiseResolver, PromiseResult, RangeResults}; +use re_query::{RangeData, LatestAtResults, PromiseResolver, PromiseResult, RangeResults}; use re_types::Component; // --- Cached --- @@ -49,12 +49,12 @@ pub trait RangeResultsExt { fn get_dense<'a, C: Component>( &'a self, resolver: &PromiseResolver, - ) -> Option>>; + ) -> Option>>; fn get_or_empty_dense<'a, C: Component>( &'a self, resolver: &PromiseResolver, - ) -> re_query::Result>; + ) -> re_query::Result>; } impl RangeResultsExt for RangeResults { @@ -62,7 +62,7 @@ impl RangeResultsExt for RangeResults { fn get_dense<'a, C: Component>( &'a self, resolver: &PromiseResolver, - ) -> Option>> { + ) -> Option>> { let results = self.get(C::name())?.to_dense(resolver); // TODO(#5607): what should happen if the promise is still pending? @@ -83,7 +83,7 @@ impl RangeResultsExt for RangeResults { fn get_or_empty_dense<'a, C: Component>( &'a self, resolver: &PromiseResolver, - ) -> re_query::Result> { + ) -> re_query::Result> { let results = self.get_or_empty(C::name()).to_dense(resolver); // TODO(#5607): what should happen if the promise is still pending? diff --git a/crates/re_space_view_tensor/src/visualizer_system.rs b/crates/re_space_view_tensor/src/visualizer_system.rs index a40414c63458c..c0f0bfb050182 100644 --- a/crates/re_space_view_tensor/src/visualizer_system.rs +++ b/crates/re_space_view_tensor/src/visualizer_system.rs @@ -1,5 +1,5 @@ use re_data_store::LatestAtQuery; -use re_entity_db::{external::re_query::CachedLatestAtMonoResult, EntityPath}; +use re_entity_db::{external::re_query::LatestAtMonoResult, EntityPath}; use re_log_types::RowId; use re_types::{archetypes::Tensor, components::TensorData, tensor_data::DecodedTensor}; use re_viewer_context::{ @@ -56,7 +56,7 @@ impl TensorSystem { &mut self, ctx: &ViewerContext<'_>, ent_path: &EntityPath, - tensor: CachedLatestAtMonoResult, + tensor: LatestAtMonoResult, ) { let row_id = tensor.row_id(); match ctx diff --git a/crates/re_space_view_text_log/src/visualizer_system.rs b/crates/re_space_view_text_log/src/visualizer_system.rs index bbe70d42141b2..fbe658b156355 100644 --- a/crates/re_space_view_text_log/src/visualizer_system.rs +++ b/crates/re_space_view_text_log/src/visualizer_system.rs @@ -1,7 +1,7 @@ use re_data_store::TimeRange; use re_entity_db::EntityPath; use re_log_types::{RowId, TimeInt}; -use re_query::{clamped_zip_1x2, range_zip_1x2, CachedRangeData, PromiseResult}; +use re_query::{clamped_zip_1x2, range_zip_1x2, RangeData, PromiseResult}; use re_types::{ archetypes::TextLog, components::{Color, Text, TextLogLevel}, @@ -132,7 +132,7 @@ impl VisualizerSystem for TextLogSystem { // TODO(#5607): what should happen if the promise is still pending? #[inline] fn check_range<'a, C: Component>( - results: &'a CachedRangeData<'a, C>, + results: &'a RangeData<'a, C>, ) -> re_query::Result<()> { let (front_status, back_status) = results.status(); match front_status {