]> git.lizzy.rs Git - rust.git/blob - src/libcore/fmt/rt/v1.rs
Auto merge of #57714 - matthewjasper:wellformed-unreachable, r=pnkfelix
[rust.git] / src / libcore / fmt / rt / v1.rs
1 //! This is an internal module used by the ifmt! runtime. These structures are
2 //! emitted to static arrays to precompile format strings ahead of time.
3 //!
4 //! These definitions are similar to their `ct` equivalents, but differ in that
5 //! these can be statically allocated and are slightly optimized for the runtime
6 #![allow(missing_debug_implementations)]
7
8 #[derive(Copy, Clone)]
9 pub struct Argument {
10     pub position: Position,
11     pub format: FormatSpec,
12 }
13
14 #[derive(Copy, Clone)]
15 pub struct FormatSpec {
16     pub fill: char,
17     pub align: Alignment,
18     pub flags: u32,
19     pub precision: Count,
20     pub width: Count,
21 }
22
23 /// Possible alignments that can be requested as part of a formatting directive.
24 #[derive(Copy, Clone, PartialEq, Eq)]
25 pub enum Alignment {
26     /// Indication that contents should be left-aligned.
27     Left,
28     /// Indication that contents should be right-aligned.
29     Right,
30     /// Indication that contents should be center-aligned.
31     Center,
32     /// No alignment was requested.
33     Unknown,
34 }
35
36 #[derive(Copy, Clone)]
37 pub enum Count {
38     Is(usize),
39     Param(usize),
40     NextParam,
41     Implied,
42 }
43
44 #[derive(Copy, Clone)]
45 pub enum Position {
46     Next,
47     At(usize),
48 }