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: 'static + Render> WindowHandle<V>
impl<V: 'static + Render> WindowHandle<V>
Sourcepub fn new(id: WindowId) -> Self
pub fn new(id: WindowId) -> Self
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>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>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>
pub fn read<'a>(&self, cx: &'a App) -> Result<&'a V>
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>where
C: AppContext,
pub fn read_with<C, R>(
&self,
cx: &C,
read_with: impl FnOnce(&V, &App) -> R,
) -> Result<R>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>§
Trait Implementations§
Source§impl<V> Clone for WindowHandle<V>
impl<V> Clone 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§impl<V> DerefMut for WindowHandle<V>
impl<V> DerefMut for WindowHandle<V>
Source§impl<V: 'static> From<WindowHandle<V>> for AnyWindowHandle
impl<V: 'static> From<WindowHandle<V>> for AnyWindowHandle
Source§fn from(val: WindowHandle<V>) -> Self
fn from(val: WindowHandle<V>) -> Self
Converts to this type from the input type.
Source§impl<V> Hash for WindowHandle<V>
impl<V> Hash for WindowHandle<V>
Source§impl<V> PartialEq for WindowHandle<V>
impl<V> PartialEq for WindowHandle<V>
impl<V> Copy for WindowHandle<V>
impl<V> Eq 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> 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
Mutably borrows from an owned value. Read more
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&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
Compare self to
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>
Converts
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>
Converts
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