Skip to main content

RCondition

Enum RCondition 

Source
#[doc(hidden)]
pub enum RCondition { Error { message: String, class: Option<String>, }, Warning { message: String, class: Option<String>, }, Message { message: String, }, Condition { message: String, class: Option<String>, }, }
Expand description

Internal panic payload for structured R conditions.

Raised by the error!(), warning!(), message!(), and condition!() macros via std::panic::panic_any. Caught by with_r_unwind_protect_error_in_r before the generic panic→string path and forwarded to R as a tagged SEXP with rust_* class layering.

This type is #[doc(hidden)] because users interact with the macros, not the enum directly.

Variants§

§

Error

Raised by error!(...) / error!(class = "...", ...).

Fields

§message: String
§

Warning

Raised by warning!(...) / warning!(class = "...", ...).

Fields

§message: String
§

Message

Raised by message!(...).

Fields

§message: String
§

Condition

Raised by condition!(...) / condition!(class = "...", ...).

Fields

§message: String

Implementations§

Source§

impl RCondition

Source

pub unsafe fn from_tagged_sexp(sexp: SEXP) -> Option<Self>

Reconstruct an RCondition::Error from a tagged SEXP produced by crate::error_value::make_rust_condition_value.

Returns Some(RCondition) when sexp has class "rust_condition_value" AND the "__rust_condition__" attribute is TRUE. Returns None for all other SEXPs (normal return values, R_NilValue, etc.).

Reconstructs the matching variant for each kind: "error"/"panic"/ "result_err"/"none_err"/"other_rust_error"RCondition::Error; "warning"RCondition::Warning; "message"RCondition::Message; "condition"RCondition::Condition. Unknown kinds degrade to RCondition::Error with the kind string prefixed to the message.

§Safety

Must be called from R’s main thread.

Trait Implementations§

Source§

impl Debug for RCondition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 56 bytes

Size for each variant:

  • Error: 48 bytes
  • Warning: 48 bytes
  • Message: 24 bytes
  • Condition: 48 bytes