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

// Copyright (C) 2019-2020 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! print {
  ($ctx:expr, $($arg:tt)*) => {
    write!($ctx.stdout, $($arg)*)
  };
}