pub struct ViewProperty {
pub blueprint_store_path: EntityPath,
/* private fields */
}
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.
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.
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>>
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>
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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
.Source§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
.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 more