#[derive(RCondition)]
{
// Attributes available to this derive:
#[condition]
}
Expand description
#[derive(RCondition)]: RConditionData generated from a type’s shape
(#[condition(class = "…")], #[condition(message = "…")], the
rename / skip / debug field options) and From<T> for
RCondition with the declared kind
(#[condition(kind = …)], default error).
Derive an R condition type for a struct or enum: RConditionData (the R
class vector, the message and the data fields handlers read as
e$<name>) and From<Self> for miniextendr_api::RCondition.
#[condition(class = "…")]on the type sets the family class (default: the type name in snake_case); on an enum variant it sets the member class (default:<family>_<variant in snake_case>). Variants reportc(<member>, <family>), structsc(<family>).#[condition(message = "…")]on a struct or a variant is aformat!string over the fields (tuple fields are_0,_1, …). Without it the message is the type’sDisplayrendering.- Every field becomes a
dataentry under its own name, converted withRValue::from(field.clone()), so its type must beClone.#[condition(rename = "…")],#[condition(skip)]and#[condition(debug)](attach theDebugrendering instead) adjust that; tuple fields needrenameorskip. The reserved slotsmessage,callandkindare rejected at compile time. #[condition(kind = error | warning | message | condition)]on the type or a variant (the variant wins) is the kindRCondition::from(value)gives it; the default iserror. Then.defer()signals it after the function returns its value, and.raise()signals it now.
The kind is read only through RCondition::from. Returned as Err(value)
from a Result<T, E>, the value is always an R error, and
defer_warning / defer_message signal
the kind they are named after. Generic types are not supported.