Skip to content

Commit

Permalink
Print values rawly to stderr.
Browse files Browse the repository at this point in the history
  • Loading branch information
01mf02 committed Sep 25, 2024
1 parent aa2e2d1 commit a0422e6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions jaq-std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,13 @@ fn debug<V: core::fmt::Display>() -> Filter<(RunPtr<V>, UpdatePtr<V>)> {
}

#[cfg(feature = "std")]
fn stderr<V: core::fmt::Display>() -> Filter<(RunPtr<V>, UpdatePtr<V>)> {
("stderr", v(0), id_with!(|x| std::eprint!("{}", x)))
fn stderr<V: ValT>() -> Filter<(RunPtr<V>, UpdatePtr<V>)> {
fn eprint_raw<V: ValT>(v: &V) {
if let Some(s) = v.as_str() {
std::eprint!("{}", s)
} else {
std::eprint!("{}", v)
}
}
("stderr", v(0), id_with!(eprint_raw))
}

0 comments on commit a0422e6

Please sign in to comment.