pub struct View<Rend: WindowRenderer> {Show 15 fields
pub doc: Box<dyn Document>,
pub renderer: Rend,
pub waker: Option<Waker>,
pub proxy: BlitzShellProxy,
pub window: Arc<dyn Window>,
pub theme_override: Option<Theme>,
pub keyboard_modifiers: Modifiers,
pub buttons: MouseEventButtons,
pub pointer_pos: PhysicalPosition<f64>,
pub active_events: Arc<AtomicRefCell<Vec<BlitzPointerEvent>>>,
pub animation_timer: Option<Instant>,
pub is_visible: bool,
pub safe_area_insets: PhysicalInsets<u32>,
pub accessibility: AccessibilityState,
pub animation_frame_due: Cell<Option<Instant>>,
/* private fields */
}Fields§
§doc: Box<dyn Document>§renderer: Rend§waker: Option<Waker>§proxy: BlitzShellProxy§window: Arc<dyn Window>§theme_override: Option<Theme>The state of the keyboard modifiers (ctrl, shift, etc). Winit/Tao don’t track these for us so we need to store them in order to have access to them when processing keypress events
keyboard_modifiers: Modifiers§pointer_pos: PhysicalPosition<f64>§active_events: Arc<AtomicRefCell<Vec<BlitzPointerEvent>>>The non-mouse pointers (touch/pen) that are currently pressed, in the order they were pressed.
This serves two purposes:
- Multi-touch: it is cloned (cheaply, via
Arc) into every dispatchedBlitzPointerEventso that touch events can report all concurrent touches via theirtoucheslist. - Cancellation detection: winit signals a cancelled touch with a
WindowEvent::PointerLeftthat is not preceded by aWindowEvent::PointerButtonwithElementState::Released. If a pointer is still in this list when it leaves, it was cancelled.
The events stored here always have an empty active_pointers list to
avoid a reference cycle.
animation_timer: Option<Instant>§is_visible: bool§safe_area_insets: PhysicalInsets<u32>§accessibility: AccessibilityStateaccessibility only.Accessibility adapter for accesskit.
animation_frame_due: Cell<Option<Instant>>When the next animation-only frame is due, if one is.
An animation drives frames by asking for the next redraw at the end of
the last one, which runs it at the display’s rate. Set this instead of
asking immediately, and about_to_wait turns it into a
ControlFlow::WaitUntil, so the loop sleeps in between rather than
spinning. None means nothing is animating and the loop can wait
indefinitely for input.
Implementations§
Source§impl<Rend: WindowRenderer> View<Rend>
impl<Rend: WindowRenderer> View<Rend>
pub fn init( config: WindowConfig<Rend>, event_loop: &dyn ActiveEventLoop, proxy: &BlitzShellProxy, ) -> Self
pub fn replace_document( &mut self, new_doc: Box<dyn Document>, retain_scroll_position: bool, )
pub fn theme_override(&self) -> Option<Theme>
pub fn current_theme(&self) -> Theme
pub fn set_theme_override(&mut self, theme: Option<Theme>)
pub fn downcast_doc_mut<T: 'static>(&mut self) -> &mut T
pub fn try_downcast_doc_mut<T: 'static>(&mut self) -> Option<&mut T>
pub fn current_animation_time(&mut self) -> f64
Source§impl<Rend: WindowRenderer> View<Rend>
impl<Rend: WindowRenderer> View<Rend>
Sourcepub fn resume(&mut self)
pub fn resume(&mut self)
Start resuming the renderer. Dispatches BlitzShellEvent::ResumeReady
when initialization completes — synchronously on native, asynchronously
on wasm32. The embedder must call complete_resume
in response.
Sourcepub fn complete_resume(&mut self) -> bool
pub fn complete_resume(&mut self) -> bool
Finalize a previously-started resume. Should be called in response to a
BlitzShellEvent::ResumeReady event. Paints the first frame and
installs the doc poll waker. Returns true if the renderer is now active.
pub fn suspend(&mut self)
Sourcepub fn request_poll(&self)
pub fn request_poll(&self)
Ask for a poll before the event loop next sleeps.
Costs one relaxed store when the flag is already set, which is the common case during a drag or a scroll.
Sourcepub fn poll_if_requested(&mut self) -> bool
pub fn poll_if_requested(&mut self) -> bool
Poll iff a poll was asked for since the last drain, clearing the request.
pub fn poll(&mut self) -> bool
pub fn request_redraw(&self)
pub fn redraw(&mut self)
Sourcepub fn poll_animation_frame(&self, now: Instant) -> Option<Instant>
pub fn poll_animation_frame(&self, now: Instant) -> Option<Instant>
Ask for the pending animation frame if it is due, and report when the next one falls due so the event loop can sleep until then.
Returns None when nothing is animating, which lets the loop wait for
input instead of on a clock.
pub fn pointer_coords(&self, position: PhysicalPosition<f64>) -> PointerCoords
pub fn window_id(&self) -> WindowId
pub fn with_viewport(&mut self, cb: impl FnOnce(&mut Viewport))
pub fn build_accessibility_tree(&mut self)
accessibility only.pub fn handle_winit_event(&mut self, event: WindowEvent)
Trait Implementations§
Source§impl<Rend: WindowRenderer> Drop for View<Rend>
impl<Rend: WindowRenderer> Drop for View<Rend>
Auto Trait Implementations§
impl<Rend> !Freeze for View<Rend>
impl<Rend> !RefUnwindSafe for View<Rend>
impl<Rend> !Send for View<Rend>
impl<Rend> !Sync for View<Rend>
impl<Rend> !UnwindSafe for View<Rend>
impl<Rend> Unpin for View<Rend>where
Rend: Unpin,
impl<Rend> UnsafeUnpin for View<Rend>where
Rend: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.impl<T> ErasedDestructor for Twhere
T: 'static,
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.