macro_rules! codes {
($n1:expr, $($n2:expr),*) => { ... };
($n1:expr, $($n2:expr,)*) => { ... };
($n:expr) => { ... };
() => { ... };
}
Expand description
Constructs a code set (to be used in a control sequence)
This simply turns a sequence of numbers into a string with a semi-colon separator.
Note that this will actually happily accept strings also, not just numeric literals.
ยงExamples:
assert_eq!("1", codes!(1));
assert_eq!("1;2;3", codes!(1, 2, 3));
assert_eq!("1;2;3;4;5", codes!(1, "2;3;4", 5));
// Use in a sequence
assert_eq!("\u{1B}[1;2;3m", seq!(codes!(1,2,3)));
assert_eq!("\u{1B}[1;2;3;4;5;6m", seq!(1,2,codes!(3,4,5),6));