pub struct RCondition<E: Error>(pub E);Expand description
Structured error wrapper that preserves the std::error::Error cause chain.
When displayed, formats the error message with its full source chain:
top-level message
caused by: middle error
caused by: root causeImplements From<E> so it works with ? and .map_err(RCondition).
§Example
ⓘ
use miniextendr_api::condition::RCondition;
use std::num::ParseIntError;
#[miniextendr]
fn parse_number(s: &str) -> Result<i32, RCondition<ParseIntError>> {
s.parse::<i32>().map_err(RCondition)
}Tuple Fields§
§0: EImplementations§
Source§impl<E: Error> RCondition<E>
impl<E: Error> RCondition<E>
Sourcepub fn into_inner(self) -> E
pub fn into_inner(self) -> E
Get the inner error.
Sourcepub fn rust_type_name(&self) -> &'static str
pub fn rust_type_name(&self) -> &'static str
Get the Rust type name of the wrapped error (for programmatic matching).
Sourcepub fn cause_chain(&self) -> Vec<String>
pub fn cause_chain(&self) -> Vec<String>
Collect the full cause chain as a Vec<String>.
Trait Implementations§
Source§impl<E: Error> Debug for RCondition<E>
impl<E: Error> Debug for RCondition<E>
Source§impl<E: Error> Display for RCondition<E>
impl<E: Error> Display for RCondition<E>
Auto Trait Implementations§
impl<E> Freeze for RCondition<E>where
E: Freeze,
impl<E> RefUnwindSafe for RCondition<E>where
E: RefUnwindSafe,
impl<E> Send for RCondition<E>where
E: Send,
impl<E> Sync for RCondition<E>where
E: Sync,
impl<E> Unpin for RCondition<E>where
E: Unpin,
impl<E> UnsafeUnpin for RCondition<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for RCondition<E>where
E: UnwindSafe,
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> RDisplay for Twhere
T: Display,
impl<T> RDisplay for Twhere
T: Display,
Source§fn as_r_string(&self) -> String
fn as_r_string(&self) -> String
Convert to a user-friendly string.