macro_rules! message {
(data = $data:tt, $($arg:tt)*) => { ... };
($($arg:tt)*) => { ... };
}Expand description
Emit an R message from Rust with rust_message class layering.
Rides the tagged-condition transport that every #[miniextendr] function uses.
The raised condition has class c("rust_message", "simpleMessage", "message", "condition").
Muffled by suppressMessages() automatically (standard R restart mechanism).
An optional data = ... form (before the message) attaches named fields
readable as m$<name> in withCallingHandlers — same grammar and
supported value types as crate::error! (see there for details). There
is no class = form for message!.
§See also
crate::warning!/crate::condition!— louder/quieter sibling kinds.crate::error!— for fatal failures.std::panic!— escape hatch.crate::error_value— tagged-SEXP transport rationale.
No name-collision caveat: there is no pub mod message, so
use miniextendr_api::message; then message!(...) works directly.
§Example
ⓘ
use miniextendr_api::message;
#[miniextendr]
fn log_step(step: i32) {
message!("step {} complete", step);
}log_step(3L)
# step 3 complete
suppressMessages(log_step(3L)) # no output