about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorwickerwaka <martin.donlon@gmail.com>2014-08-30 11:27:02 -0700
committerwickerwaka <martin.donlon@gmail.com>2014-09-04 07:38:53 -0700
commit2bc4a5e92aef51bd34a5b1a506c5edcee893d6ac (patch)
tree3ae6b60182e140f23f3d1cc772349fb5eb29b3f1 /src/libsyntax/ext
parent6d8b5c9f7d1347b715242a837fba87a01ae61d7e (diff)
downloadrust-2bc4a5e92aef51bd34a5b1a506c5edcee893d6ac.tar.gz
rust-2bc4a5e92aef51bd34a5b1a506c5edcee893d6ac.zip
Center alignment for fmt
Use '^' to specify center alignment in format strings.

fmt!( "[{:^5s}]", "Hi" ) -> "[ Hi  ]"
fmt!( "[{:^5s}]", "H" )  -> "[  H  ]"
fmt!( "[{:^5d}]", 1i )   -> "[  1  ]"
fmt!( "[{:^5d}]", -1i )  -> "[ -1  ]"
fmt!( "[{:^6d}]", 1i )   -> "[  1   ]"
fmt!( "[{:^6d}]", -1i )  -> "[  -1  ]"

If the padding is odd then the padding on the right will be one
character longer than the padding on the left.

Tuples squashed
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/format.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs
index 0994abaadc7..aa2c51c0225 100644
--- a/src/libsyntax/ext/format.rs
+++ b/src/libsyntax/ext/format.rs
@@ -430,6 +430,9 @@ impl<'a, 'b> Context<'a, 'b> {
                     parse::AlignRight => {
                         self.ecx.path_global(sp, self.rtpath("AlignRight"))
                     }
+                    parse::AlignCenter => {
+                        self.ecx.path_global(sp, self.rtpath("AlignCenter"))
+                    }
                     parse::AlignUnknown => {
                         self.ecx.path_global(sp, self.rtpath("AlignUnknown"))
                     }