diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-10-12 20:00:58 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-10-15 22:27:10 -0700 |
| commit | fc06f7922db0b4d1063f4f29157635117d853426 (patch) | |
| tree | ab33cac38ef9012c89c84a28054eab7bd364cabc /src/libstd/fmt/rt.rs | |
| parent | a84c2999c91f6ea43291006288ea6dd8c4852c3b (diff) | |
| download | rust-fc06f7922db0b4d1063f4f29157635117d853426.tar.gz rust-fc06f7922db0b4d1063f4f29157635117d853426.zip | |
Build a few extra features into format! parsing
* Allow named parameters to specify width/precision * Intepret the format string '0$' as "width is the 0th argument" instead of thinking the lone '0' was the sign-aware-zero-padding flag. To get both you'd need to put '00$' which makes more sense if you want both to happen. Closes #9669
Diffstat (limited to 'src/libstd/fmt/rt.rs')
| -rw-r--r-- | src/libstd/fmt/rt.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libstd/fmt/rt.rs b/src/libstd/fmt/rt.rs index 90763836fc6..063d712dfa9 100644 --- a/src/libstd/fmt/rt.rs +++ b/src/libstd/fmt/rt.rs @@ -34,6 +34,7 @@ pub struct Argument<'self> { method: Option<&'self Method<'self>> } +#[cfg(stage0)] pub struct FormatSpec { fill: char, align: parse::Alignment, @@ -42,6 +43,20 @@ pub struct FormatSpec { width: parse::Count, } +#[cfg(not(stage0))] +pub struct FormatSpec { + fill: char, + align: parse::Alignment, + flags: uint, + precision: Count, + width: Count, +} + +#[cfg(not(stage0))] +pub enum Count { + CountIs(uint), CountIsParam(uint), CountIsNextParam, CountImplied, +} + pub enum Position { ArgumentNext, ArgumentIs(uint) } |
