Skip to content

Commit 03326d8

Browse files
committed
---
yaml --- r: 36351 b: refs/heads/try2 c: d107e58 h: refs/heads/master i: 36349: e28ed30 36347: dd542ec 36343: 466d33a 36335: a925f85 36319: 422e79a 36287: 62f8fde 36223: a3f1ef5 36095: 5873ec5 35839: 05ec633 v: v3
1 parent 64fcd59 commit 03326d8

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: d106ef88e6a87d726630fea997699d4255fb5ebb
8+
refs/heads/try2: d107e586eaec04cf2a5d3b08cc49a6bdd14990cd
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try2/src/libcore/extfmt.rs

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,40 @@
1-
#[doc(hidden)];
1+
//! Support for fmt! expressions.
2+
//!
3+
//! The syntax is close to that of Posix format strings:
4+
//!
5+
//! ~~~~~~
6+
//! Format := '%' Parameter? Flag* Width? Precision? Type
7+
//! Parameter := [0-9]+ '$'
8+
//! Flag := [ 0#+-]
9+
//! Width := Parameter | [0-9]+
10+
//! Precision := '.' [0-9]+
11+
//! Type := [bcdfiostuxX?]
12+
//! ~~~~~~
13+
//!
14+
//! * Parameter is the 1-based argument to apply the format to. Currently not implemented.
15+
//! * Flag 0 causes leading zeros to be used for padding when converting numbers.
16+
//! * Flag # causes the conversion to be done in an *alternative* manner. Currently not implemented.
17+
//! * Flag + causes signed numbers to always be prepended with a sign character.
18+
//! * Flag - left justifies the result
19+
//! * Width specifies the minimum field width of the result. By default leading spaces are added.
20+
//! * Precision specifies the minimum number of digits for integral types and the minimum number
21+
//! of decimal places for float.
22+
//!
23+
//! The types currently supported are:
24+
//!
25+
//! * b - bool
26+
//! * c - char
27+
//! * d - int
28+
//! * f - float
29+
//! * i - int (same as d)
30+
//! * o - uint as octal
31+
//! * t - uint as binary
32+
//! * u - uint
33+
//! * x - uint as lower-case hexadecimal
34+
//! * X - uint as upper-case hexadecimal
35+
//! * s - str (any flavor)
36+
//! * ? - arbitrary type (does not use the to_str trait)
37+
238
// NB: transitionary, de-mode-ing.
339
#[forbid(deprecated_mode)];
440
#[forbid(deprecated_pattern)];
@@ -44,6 +80,7 @@ use option::{Some, None};
4480
*/
4581

4682
// Functions used by the fmt extension at compile time
83+
#[doc(hidden)]
4784
pub mod ct {
4885
pub enum Signedness { Signed, Unsigned, }
4986
pub enum Caseness { CaseUpper, CaseLower, }
@@ -277,6 +314,7 @@ pub mod ct {
277314
// decisions made a runtime. If it proves worthwhile then some of these
278315
// conditions can be evaluated at compile-time. For now though it's cleaner to
279316
// implement it 0this way, I think.
317+
#[doc(hidden)]
280318
pub mod rt {
281319
pub const flag_none : u32 = 0u32;
282320
pub const flag_left_justify : u32 = 0b00000000000001u32;
@@ -464,6 +502,7 @@ pub mod rt {
464502
}
465503
}
466504

505+
// Bulk of the tests are in src/test/run-pass/syntax-extension-fmt.rs
467506
#[cfg(test)]
468507
mod test {
469508
#[test]

0 commit comments

Comments
 (0)