mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
reduce Error-related codegen; add PoisonError
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -10,11 +10,14 @@ impl UnwindSafe for Error {}
|
||||
impl RefUnwindSafe for Error {}
|
||||
|
||||
impl Error {
|
||||
#[inline]
|
||||
pub fn panic(self) -> ! { panic_any(self.into_panic()) }
|
||||
|
||||
#[must_use]
|
||||
#[inline]
|
||||
pub fn from_panic(e: Box<dyn Any + Send>) -> Self { Self::Panic(debug::panic_str(&e), e) }
|
||||
|
||||
#[inline]
|
||||
pub fn into_panic(self) -> Box<dyn Any + Send + 'static> {
|
||||
match self {
|
||||
Self::Panic(_, e) | Self::PanicAny(e) => e,
|
||||
@@ -24,6 +27,7 @@ impl Error {
|
||||
}
|
||||
|
||||
/// Get the panic message string.
|
||||
#[inline]
|
||||
pub fn panic_str(self) -> Option<&'static str> {
|
||||
self.is_panic()
|
||||
.then_some(debug::panic_str(&self.into_panic()))
|
||||
|
||||
Reference in New Issue
Block a user