pub struct WindowHandle<V> { /* private fields */ }Expand description
A handle to a window with a specific root view type. Note that this does not keep the window alive on its own.
Implementations§
Source§impl<V> WindowHandle<V>where
V: 'static + Render,
impl<V> WindowHandle<V>where
V: 'static + Render,
Sourcepub fn new(id: WindowId) -> WindowHandle<V>
pub fn new(id: WindowId) -> WindowHandle<V>
Creates a new handle from a window ID.
This does not check if the root type of the window is V.
Sourcepub fn update<C, R>(
&self,
cx: &mut C,
update: impl FnOnce(&mut V, &mut Window, &mut Context<'_, V>) -> R,
) -> Result<R, Error>where
C: AppContext,
pub fn update<C, R>(
&self,
cx: &mut C,
update: impl FnOnce(&mut V, &mut Window, &mut Context<'_, V>) -> R,
) -> Result<R, Error>where
C: AppContext,
Updates the root view of this window.
This will fail if the window has been closed or if the root view’s type does not match
Sourcepub fn read<'a>(&self, cx: &'a App) -> Result<&'a V, Error>
pub fn read<'a>(&self, cx: &'a App) -> Result<&'a V, Error>
Read the root view out of this window.
This will fail if the window is closed or if the root view’s type does not match V.
Sourcepub fn read_with<C, R>(
&self,
cx: &C,
read_with: impl FnOnce(&V, &App) -> R,
) -> Result<R, Error>where
C: AppContext,
pub fn read_with<C, R>(
&self,
cx: &C,
read_with: impl FnOnce(&V, &App) -> R,
) -> Result<R, Error>where
C: AppContext,
Read the root view out of this window, with a callback
This will fail if the window is closed or if the root view’s type does not match V.
Methods from Deref<Target = AnyWindowHandle>§
Sourcepub fn root_entity_type_name(&self) -> &'static str
pub fn root_entity_type_name(&self) -> &'static str
Returns the name of the window’s declared root entity type.
Sourcepub fn downcast<T>(&self) -> Option<WindowHandle<T>>where
T: 'static,
pub fn downcast<T>(&self) -> Option<WindowHandle<T>>where
T: 'static,
Attempt to convert this handle to a window handle with a specific root view type.
If the types do not match, this will return None.
Trait Implementations§
Source§impl<V> Clone for WindowHandle<V>
impl<V> Clone for WindowHandle<V>
Source§fn clone(&self) -> WindowHandle<V>
fn clone(&self) -> WindowHandle<V>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<V> Copy for WindowHandle<V>
Source§impl<V> Debug for WindowHandle<V>
impl<V> Debug for WindowHandle<V>
Source§impl<V> Deref for WindowHandle<V>
impl<V> Deref for WindowHandle<V>
Source§type Target = AnyWindowHandle
type Target = AnyWindowHandle
Source§impl<V> DerefMut for WindowHandle<V>
impl<V> DerefMut for WindowHandle<V>
impl<V> Eq for WindowHandle<V>
Source§impl<V> From<WindowHandle<V>> for AnyWindowHandlewhere
V: 'static,
impl<V> From<WindowHandle<V>> for AnyWindowHandlewhere
V: 'static,
Source§fn from(val: WindowHandle<V>) -> AnyWindowHandle
fn from(val: WindowHandle<V>) -> AnyWindowHandle
Source§impl<V> Hash for WindowHandle<V>
impl<V> Hash for WindowHandle<V>
Auto Trait Implementations§
impl<V> Freeze for WindowHandle<V>
impl<V> RefUnwindSafe for WindowHandle<V>
impl<V> Send for WindowHandle<V>
impl<V> Sync for WindowHandle<V>
impl<V> Unpin for WindowHandle<V>
impl<V> UnsafeUnpin for WindowHandle<V>
impl<V> UnwindSafe for WindowHandle<V>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<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<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§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