pub struct ApprovalPrompt { /* private fields */ }Expand description
One request for permission, with the answer left to the caller.
It is a view rather than a builder because where the keyboard is has to survive a frame, and where the keyboard is is the safety property.
Implementations§
Source§impl ApprovalPrompt
impl ApprovalPrompt
Sourcepub fn new(
ident: impl Into<Ident>,
action: impl Into<SharedString>,
_window: &mut Window,
cx: &mut Context<'_, Self>,
) -> Self
pub fn new( ident: impl Into<Ident>, action: impl Into<SharedString>, _window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
action is what is about to happen, stated specifically. There is no
way to describe the request as a category instead.
Sourcepub fn detail(self, detail: DescriptionItem) -> Self
pub fn detail(self, detail: DescriptionItem) -> Self
One more specific fact about the request: the exact path, the exact command, the exact host.
pub fn details(self, details: impl IntoIterator<Item = DescriptionItem>) -> Self
Sourcepub fn always(self, scope: AlwaysScope) -> Self
pub fn always(self, scope: AlwaysScope) -> Self
Offers a standing approval. The scope is part of the argument, so the control cannot be worded without it.
pub fn status(self, status: ApprovalStatus) -> Self
pub fn current_status(&self) -> &ApprovalStatus
Sourcepub fn set_status(&mut self, status: ApprovalStatus, cx: &mut Context<'_, Self>)
pub fn set_status(&mut self, status: ApprovalStatus, cx: &mut Context<'_, Self>)
Records what happened to the request. A host that expires or supersedes a prompt says so through here rather than by removing it, so the reader finds out why the controls went away.
Sourcepub fn approve(
&mut self,
decision: ApprovalDecision,
cx: &mut Context<'_, Self>,
)
pub fn approve( &mut self, decision: ApprovalDecision, cx: &mut Context<'_, Self>, )
Reports an approval. Refused unless the prompt is still pending, so a host calling this on a resolved prompt cannot resurrect it.
pub fn decline(&mut self, cx: &mut Context<'_, Self>)
Trait Implementations§
Source§impl Debug for ApprovalPrompt
impl Debug for ApprovalPrompt
impl EventEmitter<ApprovalEvent> for ApprovalPrompt
Source§impl Focusable for ApprovalPrompt
impl Focusable for ApprovalPrompt
Source§fn focus_handle(&self, _cx: &App) -> FocusHandle
fn focus_handle(&self, _cx: &App) -> FocusHandle
Source§impl Render for ApprovalPrompt
impl Render for ApprovalPrompt
Auto Trait Implementations§
impl !RefUnwindSafe for ApprovalPrompt
impl !UnwindSafe for ApprovalPrompt
impl Freeze for ApprovalPrompt
impl Send for ApprovalPrompt
impl Sync for ApprovalPrompt
impl Unpin for ApprovalPrompt
impl UnsafeUnpin for ApprovalPrompt
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> 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