grpc_rust/
macros.rs

1/*
2 Copyright 2016 LambdaStack All rights reserved.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/// repeat - Prints out a repeat of characters
18///
19/// Currently prints characters using the default color.
20///
21/// # Example
22/// ```
23/// sep!("=", 80);
24/// ```
25#[macro_export]
26macro_rules! repeat {
27    ($e:expr, $size:expr) => {
28        let repeated: String = iter::repeat($e).take($size).collect();
29        println!("{}", repeated);
30    }
31}
32
33/// repeat_red - Prints out a repeat of characters in Red
34///
35/// Currently prints characters using the color red.
36///
37/// # Example
38/// ```
39/// repeat_red!("=", 80);
40/// ```
41#[macro_export]
42macro_rules! repeat_red {
43    ($e:expr, $size:expr) => {
44        let repeated: String = iter::repeat($e).take($size).collect();
45        println!("{}", Red.paint(repeated));
46    }
47}
48
49/// repeat_yellow - Prints out a repeat of characters in Yellow
50///
51/// Currently prints characters using the color yellow.
52///
53/// # Example
54/// ```
55/// repeat_yellow!("=", 80);
56/// ```
57#[macro_export]
58macro_rules! repeat_yellow {
59    ($e:expr, $size:expr) => {
60        let repeated: String = iter::repeat($e).take($size).collect();
61        println!("{}", Yellow.paint(repeated));
62    }
63}
64
65/// repeat_blue - Prints out a repeat of characters in Blue
66///
67/// Currently prints characters using the color blue.
68///
69/// # Example
70/// ```
71/// repeat_blue!("=", 80);
72/// ```
73#[macro_export]
74macro_rules! repeat_blue {
75    ($e:expr, $size:expr) => {
76        let repeated: String = iter::repeat($e).take($size).collect();
77        println!("{}", Blue.paint(repeated));
78    }
79}