Struct re_viewport_blueprint::ViewContents
source · pub struct ViewContents {
pub blueprint_entity_path: EntityPath,
view_class_identifier: ViewClassIdentifier,
entity_path_filter: ResolvedEntityPathFilter,
new_entity_path_filter: Arc<Mutex<ResolvedEntityPathFilter>>,
}
Expand description
Data to be added to a view, built from a blueprint_archetypes::ViewContents
.
During execution, it will walk an EntityTree
and return a [DataResultTree
]
containing any entities that match a ResolvedEntityPathFilter
.
Note: ViewContents
doesn’t implement Clone because it depends on its parent’s [ViewId
]
used for identifying the path of its data in the blueprint store. It’s ambiguous
whether the intent is for a clone to write to the same place.
If you want a new view otherwise identical to an existing one, use
ViewBlueprint::duplicate
.
Fields§
§blueprint_entity_path: EntityPath
§view_class_identifier: ViewClassIdentifier
§entity_path_filter: ResolvedEntityPathFilter
Deserialized entity path filter.
Consider this read-only.
new_entity_path_filter: Arc<Mutex<ResolvedEntityPathFilter>>
Update entity path filter.
Mutations go to this value and should be saved to the blueprint store when they occur.
Implementations§
source§impl ViewContents
impl ViewContents
pub fn is_equivalent(&self, other: &Self) -> bool
sourcepub fn entity_path_filter_is_superset_of(&self, other: &Self) -> bool
pub fn entity_path_filter_is_superset_of(&self, other: &Self) -> bool
Checks whether the results of this query “fully contains” the results of another query.
If this returns true
then the [DataQueryResult
] returned by this query should always
contain any EntityPath
that would be included in the results of the other query.
This is a conservative estimate, and may return false
in situations where the
query does in fact cover the other query. However, it should never return true
in a case where the other query would not be fully covered.
source§impl ViewContents
impl ViewContents
sourcepub fn new(
id: ViewId,
view_class_identifier: ViewClassIdentifier,
entity_path_filter: ResolvedEntityPathFilter,
) -> Self
pub fn new( id: ViewId, view_class_identifier: ViewClassIdentifier, entity_path_filter: ResolvedEntityPathFilter, ) -> Self
Creates a new ViewContents
.
This ViewContents
is ephemeral. It must be saved by calling
save_to_blueprint_store
on the enclosing ViewBlueprint
.
sourcepub fn from_db_or_default(
view_id: ViewId,
blueprint_db: &EntityDb,
query: &LatestAtQuery,
view_class_identifier: ViewClassIdentifier,
subst_env: &EntityPathSubs,
) -> Self
pub fn from_db_or_default( view_id: ViewId, blueprint_db: &EntityDb, query: &LatestAtQuery, view_class_identifier: ViewClassIdentifier, subst_env: &EntityPathSubs, ) -> Self
Attempt to load a ViewContents
from the blueprint store.
sourcepub fn save_to_blueprint_store(&self, ctx: &ViewerContext<'_>)
pub fn save_to_blueprint_store(&self, ctx: &ViewerContext<'_>)
Persist the entire ViewContents
to the blueprint store.
This only needs to be called if the ViewContents
was created with Self::new
.
Otherwise, incremental calls to set_
functions will write just the necessary component
update directly to the store.
pub fn entity_path_filter(&self) -> &ResolvedEntityPathFilter
pub fn build_resolver<'a>( &self, view_class_registry: &'a ViewClassRegistry, view: &'a ViewBlueprint, maybe_visualizable_entities_per_visualizer: &'a PerVisualizer<MaybeVisualizableEntities>, visualizable_entities_per_visualizer: &'a PerVisualizer<VisualizableEntities>, indicated_entities_per_visualizer: &'a PerVisualizer<IndicatedEntities>, ) -> DataQueryPropertyResolver<'a>
sourcepub fn set_entity_path_filter(
&self,
ctx: &ViewerContext<'_>,
entity_path_filter: ResolvedEntityPathFilter,
)
pub fn set_entity_path_filter( &self, ctx: &ViewerContext<'_>, entity_path_filter: ResolvedEntityPathFilter, )
Sets the entity path filter to the provided one.
sourcepub fn mutate_entity_path_filter(
&self,
ctx: &ViewerContext<'_>,
f: impl FnOnce(&mut ResolvedEntityPathFilter),
)
pub fn mutate_entity_path_filter( &self, ctx: &ViewerContext<'_>, f: impl FnOnce(&mut ResolvedEntityPathFilter), )
Perform arbitrary mutation on the entity path filter.
Using this method avoids triggering multiple writes to the blueprint store.
sourcepub fn remove_subtree_and_matching_rules(
&self,
ctx: &ViewerContext<'_>,
path: EntityPath,
)
pub fn remove_subtree_and_matching_rules( &self, ctx: &ViewerContext<'_>, path: EntityPath, )
Remove a subtree and any existing rules that it would match.
Because most-specific matches win, if we only add a subtree exclusion it can still be overridden by existing inclusions. This method ensures that not only do we add a subtree exclusion, but clear out any existing inclusions or (now redundant) exclusions that would match the subtree.
sourcepub fn raw_add_entity_exclusion(
&self,
ctx: &ViewerContext<'_>,
rule: ResolvedEntityPathRule,
)
pub fn raw_add_entity_exclusion( &self, ctx: &ViewerContext<'_>, rule: ResolvedEntityPathRule, )
Directly add an exclusion rule to the EntityPathFilter
.
This is a direct modification of the filter and will not do any simplification related to overlapping or conflicting rules.
If you are trying to remove an entire subtree, prefer using Self::remove_subtree_and_matching_rules
.
sourcepub fn raw_add_entity_inclusion(
&self,
ctx: &ViewerContext<'_>,
rule: ResolvedEntityPathRule,
)
pub fn raw_add_entity_inclusion( &self, ctx: &ViewerContext<'_>, rule: ResolvedEntityPathRule, )
Directly add an inclusion rule to the EntityPathFilter
.
This is a direct modification of the filter and will not do any simplification related to overlapping or conflicting rules.
sourcepub fn remove_filter_rule_for(
&self,
ctx: &ViewerContext<'_>,
ent_path: &EntityPath,
)
pub fn remove_filter_rule_for( &self, ctx: &ViewerContext<'_>, ent_path: &EntityPath, )
Remove rules for a given entity.
sourcefn save_entity_path_filter_to_blueprint(&self, ctx: &ViewerContext<'_>)
fn save_entity_path_filter_to_blueprint(&self, ctx: &ViewerContext<'_>)
Save the entity path filter.
sourcepub fn execute_query(
&self,
ctx: &StoreContext<'_>,
view_class_registry: &ViewClassRegistry,
blueprint_query: &LatestAtQuery,
view_id: ViewId,
visualizable_entities_for_visualizer_systems: &PerVisualizer<VisualizableEntities>,
) -> DataQueryResult
pub fn execute_query( &self, ctx: &StoreContext<'_>, view_class_registry: &ViewClassRegistry, blueprint_query: &LatestAtQuery, view_id: ViewId, visualizable_entities_for_visualizer_systems: &PerVisualizer<VisualizableEntities>, ) -> DataQueryResult
Build up the initial [DataQueryResult
] for this ViewContents
Note that this result will not have any resolved [PropertyOverrides
]. Those can
be added by separately calling DataQueryPropertyResolver::update_overrides
on
the result.
Trait Implementations§
source§impl Clone for ViewContents
impl Clone for ViewContents
source§fn clone(&self) -> ViewContents
fn clone(&self) -> ViewContents
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for ViewContents
impl !RefUnwindSafe for ViewContents
impl Send for ViewContents
impl Sync for ViewContents
impl Unpin for ViewContents
impl !UnwindSafe for ViewContents
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
source§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.