pub struct AppCell { /* private fields */ }Expand description
Owns the App and the one door through which its microtasks and tasks run.
Implementations§
Source§impl AppCell
impl AppCell
Sourcepub fn with_platform(platform: Rc<dyn Platform>) -> Rc<AppCell>
pub fn with_platform(platform: Rc<dyn Platform>) -> Rc<AppCell>
The App of a running program, on the host’s platform.
Sourcepub fn borrow_mut(&self) -> RefMut<'_, App>
pub fn borrow_mut(&self) -> RefMut<'_, App>
The App for one platform event or one test step. Release it before
checkpoint or elapse.
§Panics
While another borrow is held.
Sourcepub fn checkpoint(&self) -> usize
pub fn checkpoint(&self) -> usize
The microtask checkpoint — the HTML event loop’s “perform a microtask checkpoint”,
V8’s PerformMicrotaskCheckpoint, the point where Dart drains its microtask queue:
runs every queued microtask and polls every ready task, including the ones they
queue, until nothing is left. Returns the number of rounds.
The shell runs it at the end of every platform event and elapse
around every timer; a test runs it where it would pump.
§Panics
While the App is borrowed — a task borrows it itself, one closure at a time — and
after CHECKPOINT_BUDGET rounds, on the assumption of a cycle.
Sourcepub fn wake(&self)
pub fn wake(&self)
The wake the host gives for a
Dispatcher::wake_now: a post, or a task
woken on another thread. Nothing to handle, so straight to the checkpoint, and then
the host is told the new timer wakeup if anything queued during it changed the
earliest waiting timer.
§Panics
While the App is borrowed.
Sourcepub fn elapse(&self, duration: Duration)
pub fn elapse(&self, duration: Duration)
Advances the App clock by duration, firing every period of the timers that come due:
FakeAsync’s elapse, which a test uses to see each tick of a periodic timer.
A checkpoint first, then each due timer in due order with a
checkpoint after it, so a future awaiting one timer can schedule the next within the
same call. A running app takes elapse_to instead: its clock jumps
over a stall as Dart’s VM does.
§Panics
While the App is borrowed.
Sourcepub fn elapse_to(&self, target: Duration)
pub fn elapse_to(&self, target: Duration)
Moves the App clock to target, then fires the timers that came due while the app was
away once each, their tick jumping over the periods that passed:
what Dart’s VM timer queue does when the event loop reaches a timer late
(timer_impl.dart, _runTimers). A timer made or re-armed by those callbacks is measured
from target and waits for the next call. The shell calls this as platform time passes; a
test that wants each period calls elapse.
§Panics
While the App is borrowed.
Auto Trait Implementations§
impl !Freeze for AppCell
impl !RefUnwindSafe for AppCell
impl !Send for AppCell
impl !Sync for AppCell
impl !UnwindSafe for AppCell
impl Forget for AppCell
impl Move for AppCell
impl Unpin for AppCellwhere
*const RcInner<AppCell> is !null: Unpin,
*const u8 is !null: Unpin,
&'static str: Unpin,
Box<dyn Any>: Unpin,
*const RcInner<Keep> is !null: Unpin,
Rc<Keep>: Unpin,
&'static Location<'static>: Unpin,
Rc<RefCell<Vec<HandleId>>>: Unpin,
NonZero<u32>: Unpin,
*const (): Unpin,
*const RcInner<EntityKeep> is !null: Unpin,
Rc<RefCell<Vec<EntityId>>>: Unpin,
Rc<RefCell<Vec<HashSet<EntityId>>>>: Unpin,
Rc<Cell<bool>>: Unpin,
Box<dyn FnMut(&mut App) -> bool>: Unpin,
Box<dyn FnMut(&mut App, &(dyn Any + 'static)) -> bool>: Unpin,
Rc<dyn Fn(&mut App)>: Unpin,
Rc<dyn Fn(&mut App, Timer)>: Unpin,
Arc<Mutex<VecDeque<Runnable>>>: Unpin,
Arc<dyn Dispatcher>: Unpin,
Rc<dyn Platform>: Unpin,
Rc<dyn Fn(&mut App, ViewFocusEvent)>: Unpin,
Rc<dyn Fn(&mut App, DragReport)>: Unpin,
Rc<dyn Fn(&mut App, ViewId, ClipboardEvent)>: Unpin,
Rc<dyn Fn(&mut App, ViewId, EditCommand)>: Unpin,
Rc<dyn Fn(&mut App, u32)>: Unpin,
Rc<dyn Fn(&mut App, u64, TrayIconEvent)>: Unpin,
Rc<dyn Fn(&mut App, ViewId) -> bool>: Unpin,
Rc<dyn Fn(&mut App, ViewId)>: Unpin,
Rc<dyn Fn(&mut App, RequestId, ViewError)>: Unpin,
Rc<dyn Fn(&mut App, OpenRequest)>: Unpin,
Box<dyn FileHandle>: Unpin,
Box<dyn FileStream>: Unpin,
Rc<dyn Fn(&mut App, NotificationActivation)>: Unpin,
impl UnsafeUnpin for AppCellwhere
*const RcInner<AppCell> is !null: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<Slot<HandleEntry>>: UnsafeUnpin,
PhantomData<fn(HandleId) -> HandleId>: UnsafeUnpin,
*const RcInner<RefCell<Vec<HandleId>>> is !null: UnsafeUnpin,
PhantomData<RcInner<RefCell<Vec<HandleId>>>>: UnsafeUnpin,
PhantomData<(HandleId, FreedEntry)>: UnsafeUnpin,
PhantomData<HandleId>: UnsafeUnpin,
PhantomData<(HandleId, u64)>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<Slot<Slot>>: UnsafeUnpin,
PhantomData<fn(EntityId) -> EntityId>: UnsafeUnpin,
*const RcInner<RefCell<Vec<EntityId>>> is !null: UnsafeUnpin,
PhantomData<RcInner<RefCell<Vec<EntityId>>>>: UnsafeUnpin,
*const RcInner<RefCell<Vec<HashSet<EntityId>>>> is !null: UnsafeUnpin,
PhantomData<RcInner<RefCell<Vec<HashSet<EntityId>>>>>: UnsafeUnpin,
PhantomData<Effect>: UnsafeUnpin,
PhantomData<(EntityId, ())>: UnsafeUnpin,
PhantomData<(EntityId, Vec<Observer>)>: UnsafeUnpin,
PhantomData<(EntityId, Vec<EventListener>)>: UnsafeUnpin,
PhantomData<(TypeId, Retained<HandleId>)>: UnsafeUnpin,
PhantomData<(HandleId, ())>: UnsafeUnpin,
PhantomData<Listener>: UnsafeUnpin,
PhantomData<ScheduledTimer>: UnsafeUnpin,
PhantomData<(TypeId, bool)>: UnsafeUnpin,
*const ArcInner<Mutex<VecDeque<Runnable>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Mutex<VecDeque<Runnable>>>>: UnsafeUnpin,
*const ArcInner<dyn Dispatcher> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Dispatcher>>: UnsafeUnpin,
*const RcInner<dyn Platform> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Platform>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
*const (): UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, ViewFocusEvent)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, ViewFocusEvent)>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, DragReport)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, DragReport)>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, ViewId, ClipboardEvent)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, ViewId, ClipboardEvent)>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, ViewId, EditCommand)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, ViewId, EditCommand)>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, u32)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, u32)>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, u64, TrayIconEvent)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, u64, TrayIconEvent)>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, ViewId) -> bool> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, ViewId) -> bool>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, ViewId)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, ViewId)>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, RequestId, ViewError)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, RequestId, ViewError)>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, OpenRequest)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, OpenRequest)>>: UnsafeUnpin,
PhantomData<OpenRequest>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, NotificationActivation)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, NotificationActivation)>>: UnsafeUnpin,
PhantomData<NotificationActivation>: 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.