aboutsummaryrefslogtreecommitdiff
path: root/src/redefine.rs
blob: dad452923001bf77e6f053d6cb6c961a877e532d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// redefine.rs

// Copyright (C) 2019 The Nitrocli Developers
// SPDX-License-Identifier: GPL-3.0-or-later

// A replacement of the standard println!() macro that requires an
// execution context as the first argument and prints to its stdout.
macro_rules! println {
  ($ctx:expr) => {
    writeln!($ctx.stdout, "")
  };
  ($ctx:expr, $($arg:tt)*) => {
    writeln!($ctx.stdout, $($arg)*)
  };
}

macro_rules! eprintln {
  ($ctx:expr) => {
    writeln!($ctx.stderr, "")
  };
  ($ctx:expr, $($arg:tt)*) => {
    writeln!($ctx.stderr, $($arg)*)
  };
}