1 // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 //! This is an internal module used by the ifmt! runtime. These structures are
12 //! emitted to static arrays to precompile format strings ahead of time.
14 //! These definitions are similar to their `ct` equivalents, but differ in that
15 //! these can be statically allocated and are slightly optimized for the runtime
17 #![allow(missing_doc)]
24 // FIXME(#8259): this shouldn't require the unit-value here
26 Argument(Argument<'a>),
29 pub struct Argument<'a> {
30 pub position: Position,
31 pub format: FormatSpec,
32 pub method: Option<&'a Method<'a>>
35 pub struct FormatSpec {
51 CountIs(uint), CountIsParam(uint), CountIsNextParam, CountImplied,
55 ArgumentNext, ArgumentIs(uint)
66 Plural(Option<uint>, &'a [PluralArm<'a>], &'a [Piece<'a>]),
67 Select(&'a [SelectArm<'a>], &'a [Piece<'a>]),
70 pub enum PluralSelector {
71 Keyword(PluralKeyword),
75 pub enum PluralKeyword {
83 pub struct PluralArm<'a> {
84 pub selector: PluralSelector,
85 pub result: &'a [Piece<'a>],
88 pub struct SelectArm<'a> {
89 pub selector: &'a str,
90 pub result: &'a [Piece<'a>],