Skip to main content

AppCell

Struct AppCell 

Source
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

Source

pub fn new() -> Rc<AppCell>

An App on an inert platform, for tests.

Source

pub fn with_platform(platform: Rc<dyn Platform>) -> Rc<AppCell>

The App of a running program, on the host’s platform.

Source

pub fn borrow(&self) -> Ref<'_, App>

§Panics

While borrow_mut is held.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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 AppCell
where *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 AppCell
where *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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more