pub struct FailurePanel { /* private fields */ }Expand description
A panel that states what went wrong instead of what it was going to show.
Implementations§
Source§impl FailurePanel
impl FailurePanel
pub fn new(ident: impl Into<Ident>, reason: impl Into<SharedString>) -> Self
Sourcepub fn from_result<T, E: Display>(
ident: impl Into<Ident>,
result: &Result<T, E>,
) -> Option<Self>
pub fn from_result<T, E: Display>( ident: impl Into<Ident>, result: &Result<T, E>, ) -> Option<Self>
The panel for a failure the host is already holding, or None when it
is holding a value instead.
This is the seam the whole component exists for: the caller renders its
content in the Ok arm and this in the Err arm, and the failure it
shows is the one the host actually has rather than one this crate
caught.
Sourcepub fn title(self, title: impl Into<SharedString>) -> Self
pub fn title(self, title: impl Into<SharedString>) -> Self
What the panel was going to be, so the reader knows which part of the window is missing rather than only that something is.
pub fn detail(self, detail: impl Into<SharedString>) -> Self
Sourcepub fn attempts(self, attempts: usize) -> Self
pub fn attempts(self, attempts: usize) -> Self
How many times this has been tried. A retry that keeps failing is a different fact from a first failure, and hiding the count would let a reader keep pressing a control that has never once worked.
Sourcepub fn retrying(self, retrying: bool) -> Self
pub fn retrying(self, retrying: bool) -> Self
Whether a retry is in flight. While it is, the failure stays on screen: nothing has replaced it yet.
Sourcepub fn on_retry(self, handler: impl Fn(&mut Window, &mut App) + 'static) -> Self
pub fn on_retry(self, handler: impl Fn(&mut Window, &mut App) + 'static) -> Self
Reports that the typist asked for another attempt.
Retrying belongs to the host — this panel has no idea what produced the failure — so it reports and does nothing. A panel with no handler shows no retry control at all rather than a dead one.
Trait Implementations§
Source§impl Debug for FailurePanel
impl Debug for FailurePanel
Source§impl IntoElement for FailurePanel
impl IntoElement for FailurePanel
Source§type Element = ViewElement<FailurePanel>
type Element = ViewElement<FailurePanel>
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl RenderOnce for FailurePanel
impl RenderOnce for FailurePanel
Source§fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement
Render::render() method
which takes a mutable reference.Auto Trait Implementations§
impl !RefUnwindSafe for FailurePanel
impl !Send for FailurePanel
impl !Sync for FailurePanel
impl !UnwindSafe for FailurePanel
impl Freeze for FailurePanel
impl Unpin for FailurePanel
impl UnsafeUnpin for FailurePanel
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
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<E> Flipping for Ewhere
E: IntoElement,
impl<E> Flipping for Ewhere
E: IntoElement,
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
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