Expand description
§Condition objects
In R, a condition is an S3 list with:
message: a character vector describing the conditioncall: the call that triggered the condition, orNULL- a class attribute including
"condition"and optionally"error","warning", or"message"
rlang conditions may include trace and parent fields, which are
represented as Option<List> and Option<RCondition> respectively.
§Types
This module provides four types:
-
ConditionKind: an enum discriminating the base R condition type (condition,message,warning,error). -
Condition: a Rust-native representation. Construct one withConditionBuilder::default(). This is the primary type we encourage you to work with for its ergonomics due to its use of std types. -
RCondition: a thin wrapper around aListthat already exists in R memory as a proper condition object. Use this when receiving or returning condition objects at the R boundary. -
ConditionBuilder: a builder forCondition. Create a builder withConditionBuilder::default()to start, chain setters, and call.build()to produce aCondition.
§Conversions
| From \ To | List | RCondition | Robj | Condition |
|---|---|---|---|---|
Condition | From | From | From | — |
List | — | TryFrom | blanket | TryFrom |
&List | — | TryFrom | — | TryFrom |
RCondition | From | — | From | TryFrom |
Robj | — | TryFrom | — | TryFrom |
&Robj | — | TryFrom | — | TryFrom |
Structs§
- Condition
- Rust-native representation of an R condition.
- Condition
Builder - Builder for constructing a
Condition. - RCondition
- A validated R condition object held as a
List.
Enums§
- Condition
Kind - Discriminates the kind of R condition being constructed.
Functions§
- format_
cnd_ message - Format an error message with rlang-style bullets.
- format_
warn_ message - Format a warning message with rlang-style bullets.