pub struct PendingPresentationIntents { /* private fields */ }Expand description
Coalescing store for presentation operations requested while detached.
Title, size, cursor, and redraw use last-value/boolean coalescing. Chrome operations retain every value in insertion order without a capacity bound. Cloning duplicates all owned titles and queued operations.
§Examples
use ailloli_ui_runtime::app::{PendingPresentationIntents, PresentationIntent};
let mut pending = PendingPresentationIntents::default();
pending.push(PresentationIntent::SetTitle("first".into()));
pending.push(PresentationIntent::SetTitle("last".into()));
assert_eq!(pending.drain(), [PresentationIntent::SetTitle("last".into())]);Implementations§
Source§impl PendingPresentationIntents
Provides the operations defined for PendingPresentationIntents.
impl PendingPresentationIntents
Provides the operations defined for PendingPresentationIntents.
Sourcepub fn push(&mut self, intent: PresentationIntent)
pub fn push(&mut self, intent: PresentationIntent)
Coalesces or appends one deferred operation.
State-setting intents overwrite the prior value; redraw becomes true; chrome operations append and can grow the vector without bound.
§Examples
use ailloli_ui_runtime::app::{PendingPresentationIntents, PresentationIntent};
let mut pending = PendingPresentationIntents::default();
pending.push(PresentationIntent::Redraw);
pending.push(PresentationIntent::Redraw);
assert_eq!(pending.drain(), [PresentationIntent::Redraw]);Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns whether no coalesced or queued operation is pending.
§Examples
use ailloli_ui_runtime::app::{PendingPresentationIntents, PresentationIntent};
let mut pending = PendingPresentationIntents::default();
assert!(pending.is_empty());
pending.push(PresentationIntent::Redraw);
assert!(!pending.is_empty());Sourcepub fn drain(&mut self) -> Vec<PresentationIntent>
pub fn drain(&mut self) -> Vec<PresentationIntent>
Drains coalesced intents in deterministic replay order.
Replay order is title, size, cursor, every chrome operation in insertion order, then redraw, regardless of original interleaving. All stored state is cleared; a second drain is empty.
§Examples
use ailloli_ui_core::Size;
use ailloli_ui_runtime::app::{PendingPresentationIntents, PresentationCursor, PresentationIntent};
let mut pending = PendingPresentationIntents::default();
pending.push(PresentationIntent::Redraw);
pending.push(PresentationIntent::SetCursor(PresentationCursor::Text));
pending.push(PresentationIntent::SetInnerSize(Size::new(10.0, 20.0)));
assert_eq!(pending.drain(), [
PresentationIntent::SetInnerSize(Size::new(10.0, 20.0)),
PresentationIntent::SetCursor(PresentationCursor::Text),
PresentationIntent::Redraw,
]);
assert!(pending.is_empty());Trait Implementations§
Source§impl Clone for PendingPresentationIntents
impl Clone for PendingPresentationIntents
Source§fn clone(&self) -> PendingPresentationIntents
fn clone(&self) -> PendingPresentationIntents
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PendingPresentationIntents
impl Debug for PendingPresentationIntents
Source§impl Default for PendingPresentationIntents
impl Default for PendingPresentationIntents
Source§fn default() -> PendingPresentationIntents
fn default() -> PendingPresentationIntents
impl StructuralPartialEq for PendingPresentationIntents
Auto Trait Implementations§
impl Freeze for PendingPresentationIntents
impl RefUnwindSafe for PendingPresentationIntents
impl Send for PendingPresentationIntents
impl Sync for PendingPresentationIntents
impl Unpin for PendingPresentationIntents
impl UnwindSafe for PendingPresentationIntents
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<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
Source§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.