pub struct ViewProperty {
pub blueprint_store_path: EntityPath,
archetype_name: ArchetypeName,
component_names: Vec<ComponentName>,
query_results: LatestAtResults,
blueprint_query: LatestAtQuery,
}
Expand description
Utility for querying view properties.
Fields§
§blueprint_store_path: EntityPath
Entity path in the blueprint store where all components of this view property archetype are stored.
archetype_name: ArchetypeName
§component_names: Vec<ComponentName>
§query_results: LatestAtResults
§blueprint_query: LatestAtQuery
Implementations§
source§impl ViewProperty
impl ViewProperty
sourcepub fn from_archetype<A: Archetype>(
blueprint_db: &EntityDb,
blueprint_query: &LatestAtQuery,
view_id: SpaceViewId
) -> Self
pub fn from_archetype<A: Archetype>( blueprint_db: &EntityDb, blueprint_query: &LatestAtQuery, view_id: SpaceViewId ) -> Self
Query a specific view property for a given view.
fn from_archetype_impl( blueprint_db: &EntityDb, blueprint_query: LatestAtQuery, space_view_id: SpaceViewId, archetype_name: ArchetypeName, component_names: &[ComponentName] ) -> Self
sourcepub fn component_or_fallback<C: Component + Default>(
&self,
ctx: &ViewerContext<'_>,
fallback_provider: &dyn ComponentFallbackProvider,
view_state: &dyn SpaceViewState
) -> Result<C, ViewPropertyQueryError>
pub fn component_or_fallback<C: Component + Default>( &self, ctx: &ViewerContext<'_>, fallback_provider: &dyn ComponentFallbackProvider, view_state: &dyn SpaceViewState ) -> Result<C, ViewPropertyQueryError>
Get the value of a specific component or its fallback if the component is not present.
sourcepub fn component_array_or_fallback<C: Component + Default>(
&self,
ctx: &ViewerContext<'_>,
fallback_provider: &dyn ComponentFallbackProvider,
view_state: &dyn SpaceViewState
) -> Result<Vec<C>, ViewPropertyQueryError>
pub fn component_array_or_fallback<C: Component + Default>( &self, ctx: &ViewerContext<'_>, fallback_provider: &dyn ComponentFallbackProvider, view_state: &dyn SpaceViewState ) -> Result<Vec<C>, ViewPropertyQueryError>
Get the component array for a given type or its fallback if the component is not present or empty.
sourcepub fn component_or_empty<C: Component>(
&self
) -> Result<Option<C>, DeserializationError>
pub fn component_or_empty<C: Component>( &self ) -> Result<Option<C>, DeserializationError>
Get a single component or None, not using any fallbacks.
sourcepub fn component_array<C: Component>(
&self
) -> Result<Option<Vec<C>>, DeserializationError>
pub fn component_array<C: Component>( &self ) -> Result<Option<Vec<C>>, DeserializationError>
Get the component array for a given type, not using any fallbacks.
sourcepub fn component_array_or_empty<C: Component>(
&self
) -> Result<Vec<C>, DeserializationError>
pub fn component_array_or_empty<C: Component>( &self ) -> Result<Vec<C>, DeserializationError>
Get the component array for a given type or an empty array, not using any fallbacks.
pub fn component_row_id(&self, component_name: ComponentName) -> Option<RowId>
pub fn component_raw( &self, component_name: ComponentName ) -> Option<Box<dyn Array>>
fn component_or_fallback_raw( &self, ctx: &ViewerContext<'_>, component_name: ComponentName, fallback_provider: &dyn ComponentFallbackProvider, view_state: &dyn SpaceViewState ) -> Box<dyn Array>
sourcepub fn save_blueprint_component(
&self,
ctx: &ViewerContext<'_>,
components: &dyn ComponentBatch
)
pub fn save_blueprint_component( &self, ctx: &ViewerContext<'_>, components: &dyn ComponentBatch )
Save change to a blueprint component.
sourcepub fn clear_blueprint_component<C: Component>(&self, ctx: &ViewerContext<'_>)
pub fn clear_blueprint_component<C: Component>(&self, ctx: &ViewerContext<'_>)
Clears a blueprint component.
sourcepub fn reset_blueprint_component<C: Component>(&self, ctx: &ViewerContext<'_>)
pub fn reset_blueprint_component<C: Component>(&self, ctx: &ViewerContext<'_>)
Resets a blueprint component to the value it had in the default blueprint.
sourcepub fn reset_all_components(&self, ctx: &ViewerContext<'_>)
pub fn reset_all_components(&self, ctx: &ViewerContext<'_>)
Resets all components to the values they had in the default blueprint.
sourcepub fn reset_all_components_to_empty(&self, ctx: &ViewerContext<'_>)
pub fn reset_all_components_to_empty(&self, ctx: &ViewerContext<'_>)
Resets all components to empty values, i.e. the fallback.
sourcepub fn any_non_empty(&self) -> bool
pub fn any_non_empty(&self) -> bool
Returns whether any property is non-empty.
sourcepub fn query_context<'a>(
&'a self,
viewer_ctx: &'a ViewerContext<'_>,
view_state: &'a dyn SpaceViewState
) -> QueryContext<'a>
pub fn query_context<'a>( &'a self, viewer_ctx: &'a ViewerContext<'_>, view_state: &'a dyn SpaceViewState ) -> QueryContext<'a>
Create a query context for this view property.
Auto Trait Implementations§
impl Freeze for ViewProperty
impl !RefUnwindSafe for ViewProperty
impl Send for ViewProperty
impl Sync for ViewProperty
impl Unpin for ViewProperty
impl !UnwindSafe for ViewProperty
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>
§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