Macro tt_num::tt_atoi [−][src]
macro_rules! tt_atoi { { $caller:tt input = [{ }] acc = [{ $($a:tt)* }] } => { ... }; { $caller:tt input = [{ 0 $($n:tt)* }] acc = [{ $($a:tt)* }] } => { ... }; { $caller:tt input = [{ 1 $($n:tt)* }] acc = [{ $($a:tt)* }] } => { ... }; { $caller:tt input = [{ 2 $($n:tt)* }] acc = [{ $($a:tt)* }] } => { ... }; { $caller:tt input = [{ 3 $($n:tt)* }] acc = [{ $($a:tt)* }] } => { ... }; { $caller:tt input = [{ 4 $($n:tt)* }] acc = [{ $($a:tt)* }] } => { ... }; { $caller:tt input = [{ 5 $($n:tt)* }] acc = [{ $($a:tt)* }] } => { ... }; { $caller:tt input = [{ 6 $($n:tt)* }] acc = [{ $($a:tt)* }] } => { ... }; { $caller:tt input = [{ 7 $($n:tt)* }] acc = [{ $($a:tt)* }] } => { ... }; { $caller:tt input = [{ 8 $($n:tt)* }] acc = [{ $($a:tt)* }] } => { ... }; { $caller:tt input = [{ 9 $($n:tt)* }] acc = [{ $($a:tt)* }] } => { ... }; }
Convert a number from pseudo-base-10 to a unary encoding. [tt-call]
Input
input = [{
integer literal, N, with each digit as a separate token}]
acc = [{ }]
(for internal use, must be empty)
Output
input = [{
sequence of N tokens (namely.
)}]
Example
#![feature(use_extern_macros)] extern crate tt_call; extern crate tt_num; use tt_call::tt_call; use tt_num::tt_atoi; fn main() { assert_eq!( tt_call! { macro = [{ tt_atoi }] input = [{ 1 0 }] acc = [{ }] ~~> stringify }, "input = [ { . . . . . . . . . . } ]" ); }
See also examples/times.rs
.