diff options
author | Martin Fischer <martin@push-f.com> | 2021-11-30 07:28:21 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-11-30 11:22:35 +0100 |
commit | 14f1a85d994ad97dae3d9de735fc51adb25d390a (patch) | |
tree | 0fa0d7c173a19dcb7117132325a801808302bcf8 /src/macros.rs | |
parent | baf1477c587fe22d27e94408cf2505d588ba007e (diff) |
introduce Error enum
Diffstat (limited to 'src/macros.rs')
-rw-r--r-- | src/macros.rs | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/src/macros.rs b/src/macros.rs index d87ea98..558a4a9 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -31,23 +31,3 @@ macro_rules! time { (result, dt) }}; } - -/// Conditionally perform string formatting. -/// -/// If `$enabled` is true, then do the formatting and return a `Cow::Owned`. -/// -/// Otherwise, just return the borrowed (often `'static`) string -/// `$borrowed`. -/// -/// When `$enabled` is false, this avoids the overhead of allocating -/// and writing to a buffer, as well as any overhead or side effects -/// of the format arguments. -macro_rules! format_if { - ($enabled:expr, $borrowed:expr, $fmt:expr, $($args:expr),*) => { - if $enabled { - ::std::borrow::Cow::Owned(format!($fmt, $($args),*)) as ::std::borrow::Cow<str> - } else { - ::std::borrow::Cow::Borrowed($borrowed) - } - } -} |