pub struct DialogQueue { /* private fields */ }Expand description
A FIFO queue of pending dialog requests and a map of posted responses.
Call request to enqueue a dialog; the backend
picks it up from pop_pending and posts
the result via respond. App code polls with
pop_response.
Implementations§
Source§impl DialogQueue
impl DialogQueue
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty DialogQueue.
Sourcepub fn request(&mut self, kind: DialogKind) -> DialogId
pub fn request(&mut self, kind: DialogKind) -> DialogId
Enqueue a dialog request and return its DialogId.
The id is stable and can be used later to poll the response.
Sourcepub fn pop_pending(&mut self) -> Option<DialogRequest>
pub fn pop_pending(&mut self) -> Option<DialogRequest>
Dequeue the oldest pending dialog request, if any.
Back-end adapters call this each frame to discover new dialogs to show.
Sourcepub fn respond(&mut self, id: DialogId, response: DialogResponse)
pub fn respond(&mut self, id: DialogId, response: DialogResponse)
Post a response for a completed dialog.
The response is stored until the app code polls it with
pop_response.
Sourcepub fn pop_response(&mut self, id: DialogId) -> Option<DialogResponse>
pub fn pop_response(&mut self, id: DialogId) -> Option<DialogResponse>
Consume and return the response for the given dialog, if one has been posted.
Returns None if the response has not yet been posted or was already consumed.
Sourcepub fn peek_response(&self, id: DialogId) -> Option<&DialogResponse>
pub fn peek_response(&self, id: DialogId) -> Option<&DialogResponse>
Peek at the response without consuming it.
Sourcepub fn is_pending_empty(&self) -> bool
pub fn is_pending_empty(&self) -> bool
Returns true if there are no pending (unshown) dialog requests.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Returns the number of pending (unshown) dialog requests.
Sourcepub fn is_responses_empty(&self) -> bool
pub fn is_responses_empty(&self) -> bool
Returns true if there are no ready (unread) responses.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DialogQueue
impl RefUnwindSafe for DialogQueue
impl Send for DialogQueue
impl Sync for DialogQueue
impl Unpin for DialogQueue
impl UnsafeUnpin for DialogQueue
impl UnwindSafe for DialogQueue
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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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 more