pub struct PanicHandlerBuilder { /* private fields */ }Implementations§
Source§impl PanicHandlerBuilder
impl PanicHandlerBuilder
Sourcepub fn build(self) -> PanicHandler
pub fn build(self) -> PanicHandler
Builds the PanicHandler
Examples found in repository?
More examples
examples/custom_title.rs (line 15)
3fn main() {
4 App::new()
5 .add_plugins(DefaultPlugins)
6 .add_plugins(
7 bevy_panic_handler::PanicHandler::new()
8 .set_title_func(|info| {
9 format!(
10 "Panic at L{}:C{}",
11 info.location().unwrap().line(),
12 info.location().unwrap().column()
13 )
14 })
15 .build(),
16 )
17 .add_systems(Startup, || panic!("Example Message"))
18 .run();
19}examples/custom_body.rs (line 23)
3fn main() {
4 App::new()
5 .add_plugins(DefaultPlugins)
6 .add_plugins(
7 bevy_panic_handler::PanicHandler::new()
8 .set_body_func(|info| {
9 format!(
10 "Panicked at Line {}, Column {}.\nMessage:\n{}",
11 info.location().unwrap().line(),
12 info.location().unwrap().column(),
13 info.payload()
14 .downcast_ref::<String>()
15 .cloned()
16 .unwrap_or_else(|| info
17 .payload()
18 .downcast_ref::<&str>()
19 .unwrap_or(&"")
20 .to_string())
21 )
22 })
23 .build(),
24 )
25 .add_systems(Startup, || panic!("Example Message"))
26 .run();
27}Sourcepub fn take_call_from_existing(self) -> Self
pub fn take_call_from_existing(self) -> Self
After the popup is closed, the previously existing panic hook will be called
Sourcepub fn set_call_func(self, call_func: impl PanicHandleFn<()>) -> Self
pub fn set_call_func(self, call_func: impl PanicHandleFn<()>) -> Self
After the popup is closed, this function will be called
Sourcepub fn set_title_func(self, title_func: impl PanicHandleFn<String>) -> Self
pub fn set_title_func(self, title_func: impl PanicHandleFn<String>) -> Self
The popup title will be set to the result of this function
Examples found in repository?
examples/custom_title.rs (lines 8-14)
3fn main() {
4 App::new()
5 .add_plugins(DefaultPlugins)
6 .add_plugins(
7 bevy_panic_handler::PanicHandler::new()
8 .set_title_func(|info| {
9 format!(
10 "Panic at L{}:C{}",
11 info.location().unwrap().line(),
12 info.location().unwrap().column()
13 )
14 })
15 .build(),
16 )
17 .add_systems(Startup, || panic!("Example Message"))
18 .run();
19}Sourcepub fn set_body_func(self, body_func: impl PanicHandleFn<String>) -> Self
pub fn set_body_func(self, body_func: impl PanicHandleFn<String>) -> Self
The popup body will be set to the result of this function
Examples found in repository?
examples/custom_body.rs (lines 8-22)
3fn main() {
4 App::new()
5 .add_plugins(DefaultPlugins)
6 .add_plugins(
7 bevy_panic_handler::PanicHandler::new()
8 .set_body_func(|info| {
9 format!(
10 "Panicked at Line {}, Column {}.\nMessage:\n{}",
11 info.location().unwrap().line(),
12 info.location().unwrap().column(),
13 info.payload()
14 .downcast_ref::<String>()
15 .cloned()
16 .unwrap_or_else(|| info
17 .payload()
18 .downcast_ref::<&str>()
19 .unwrap_or(&"")
20 .to_string())
21 )
22 })
23 .build(),
24 )
25 .add_systems(Startup, || panic!("Example Message"))
26 .run();
27}Trait Implementations§
Source§impl Default for PanicHandlerBuilder
impl Default for PanicHandlerBuilder
Source§fn default() -> PanicHandlerBuilder
fn default() -> PanicHandlerBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PanicHandlerBuilder
impl !RefUnwindSafe for PanicHandlerBuilder
impl Send for PanicHandlerBuilder
impl Sync for PanicHandlerBuilder
impl Unpin for PanicHandlerBuilder
impl !UnwindSafe for PanicHandlerBuilder
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
Mutably borrows from an owned value. Read more
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>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
Converts
&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)
Converts
&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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
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>
Converts
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>
Converts
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 moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.