pub struct AnyView { /* private fields */ }Expand description
A dynamically-typed view handle that can be downcast to a specific Entity<V>.
This is the type-erased counterpart to [ViewElement]: it holds an entity plus
a function pointer to its render, and is itself a View, so embedding it as an
element goes through the same [ViewElement] machinery as any other view.
Implementations§
Source§impl AnyView
impl AnyView
Sourcepub fn cached(self, style: StyleRefinement) -> ViewElement<AnyView>
pub fn cached(self, style: StyleRefinement) -> ViewElement<AnyView>
Embed this view as a cached [ViewElement] laid out at style.
The rendered subtree is recycled from the previous frame unless Context::notify was called on the backing entity since it was rendered (or Window::refresh is called, which ignores caching).
Sourcepub fn downgrade(&self) -> AnyWeakView
pub fn downgrade(&self) -> AnyWeakView
Convert this to a weak handle.
Sourcepub fn downcast<T: 'static>(self) -> Result<Entity<T>, Self>
pub fn downcast<T: 'static>(self) -> Result<Entity<T>, Self>
Convert this to a Entity of a specific type.
If this handle does not contain a view of the specified type, returns itself in an Err variant.
Sourcepub fn entity_type(&self) -> TypeId
pub fn entity_type(&self) -> TypeId
Gets the TypeId of the underlying view.
Trait Implementations§
impl Eq for AnyView
Source§impl IntoElement for AnyView
impl IntoElement for AnyView
Source§type Element = ViewElement<AnyView>
type Element = ViewElement<AnyView>
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Auto Trait Implementations§
impl !RefUnwindSafe for AnyView
impl !UnwindSafe for AnyView
impl Freeze for AnyView
impl Send for AnyView
impl Sync for AnyView
impl Unpin for AnyView
impl UnsafeUnpin for AnyView
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
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