[−][src]Struct syntax_ext::format::Context
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Fields
ecx: &'a mut ExtCtxt<'b>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
macsp: Span
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
The macro's call site. References to unstable formatting internals must use this span to pass the stability checker.
fmtsp: Span
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
The span of the format string literal.
args: Vec<P<Expr>>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
List of parsed argument expressions. Named expressions are resolved early, and are appended to the end of argument expressions.
Example showing the various data structures in motion:
- Original:
"{foo:o} {:o} {foo:x} {0:x} {1:o} {:x} {1:x} {0:o}" - Implicit argument resolution:
"{foo:o} {0:o} {foo:x} {0:x} {1:o} {1:x} {1:x} {0:o}" - Name resolution:
"{2:o} {0:o} {2:x} {0:x} {1:o} {1:x} {1:x} {0:o}" arg_types(in JSON):[[0, 1, 0], [0, 1, 1], [0, 1]]arg_unique_types(in simplified JSON):[["o", "x"], ["o", "x"], ["o", "x"]]names(in JSON):{"foo": 2}
arg_types: Vec<Vec<usize>>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Placeholder slot numbers indexed by argument.
arg_unique_types: Vec<Vec<ArgumentType>>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Unique format specs seen for each argument.
names: FxHashMap<String, usize>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Map from named arguments to their resolved indices.
literal: String
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
The latest consecutive literal strings, or empty if there weren't any.
pieces: Vec<P<Expr>>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Collection of the compiled rt::Argument structures
str_pieces: Vec<P<Expr>>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Collection of string literals
all_pieces_simple: bool
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Stays true if all formatting parameters are default (as in "{}{}").
arg_index_map: Vec<Vec<usize>>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Mapping between positional argument references and indices into the
final generated static argument array. We record the starting indices
corresponding to each positional argument, and number of references
consumed so far for each argument, to facilitate correct Position
mapping in build_piece. In effect this can be seen as a "flattened"
version of arg_unique_types.
Again with the example described above in docstring for args:
arg_index_map(in JSON):[[0, 1, 0], [2, 3, 3], [4, 5]]
count_args_index_offset: usize
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Starting offset of count argument slots.
count_args: Vec<Position>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Count argument slots and tracking data structures. Count arguments are separately tracked for de-duplication in case multiple references are made to one argument. For example, in this format string:
- Original:
"{:.*} {:.foo$} {1:.*} {:.0$}" - Implicit argument resolution:
"{1:.0$} {2:.foo$} {1:.3$} {4:.0$}" - Name resolution:
"{1:.0$} {2:.5$} {1:.3$} {4:.0$}" count_positions(in JSON):{0: 0, 5: 1, 3: 2}count_args:vec![Exact(0), Exact(5), Exact(3)]
count_positions: FxHashMap<usize, usize>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Relative slot numbers for count arguments.
count_positions_count: usize
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Number of count slots assigned.
curarg: usize
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Current position of the implicit positional arg pointer, as if it
still existed in this phase of processing.
Used only for all_pieces_simple tracking in build_piece.
curpiece: usize
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Current piece being evaluated, used for error reporting.
invalid_refs: Vec<(usize, usize)>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Keep track of invalid references to positional arguments.
arg_spans: Vec<Span>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Spans of all the formatting arguments, in order.
is_literal: bool
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Whether this formatting string is a literal or it comes from a macro.
Methods
impl<'a, 'b> Context<'a, 'b>[src]
impl<'a, 'b> Context<'a, 'b>fn resolve_name_inplace(&self, p: &mut Piece)[src]
fn resolve_name_inplace(&self, p: &mut Piece)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn verify_piece(&mut self, p: &Piece)[src]
fn verify_piece(&mut self, p: &Piece)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Verifies one piece of a parse string, and remembers it if valid. All errors are not emitted as fatal so we can continue giving errors about this and possibly other format strings.
fn verify_count(&mut self, c: Count)[src]
fn verify_count(&mut self, c: Count)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn describe_num_args(&self) -> Cow<str>[src]
fn describe_num_args(&self) -> Cow<str>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn report_invalid_references(&self, numbered_position_args: bool)[src]
fn report_invalid_references(&self, numbered_position_args: bool)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Handle invalid references to positional arguments. Output different errors for the case where all arguments are positional and for when there are named arguments or numbered positional arguments in the format string.
fn verify_arg_type(&mut self, arg: Position, ty: ArgumentType)[src]
fn verify_arg_type(&mut self, arg: Position, ty: ArgumentType)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Actually verifies and tracks a given format placeholder (a.k.a. argument).
fn build_index_map(&mut self)[src]
fn build_index_map(&mut self)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Builds the mapping between format placeholders and argument objects.
fn rtpath(ecx: &ExtCtxt, s: &str) -> Vec<Ident>[src]
fn rtpath(ecx: &ExtCtxt, s: &str) -> Vec<Ident>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn build_count(&self, c: Count) -> P<Expr>[src]
fn build_count(&self, c: Count) -> P<Expr>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn build_literal_string(&mut self) -> P<Expr>[src]
fn build_literal_string(&mut self) -> P<Expr>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Build a literal expression from the accumulated string literals
fn build_piece(
&mut self,
piece: &Piece,
arg_index_consumed: &mut Vec<usize>
) -> Option<P<Expr>>[src]
fn build_piece(
&mut self,
piece: &Piece,
arg_index_consumed: &mut Vec<usize>
) -> Option<P<Expr>>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Build a static rt::Argument from a parse::Piece or append
to the literal string.
fn into_expr(self) -> P<Expr>[src]
fn into_expr(self) -> P<Expr>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Actually builds the expression which the format_args! block will be expanded to
fn format_arg(
ecx: &ExtCtxt,
macsp: Span,
sp: Span,
ty: &ArgumentType,
arg: Ident
) -> P<Expr>[src]
fn format_arg(
ecx: &ExtCtxt,
macsp: Span,
sp: Span,
ty: &ArgumentType,
arg: Ident
) -> P<Expr>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Auto Trait Implementations
Blanket Implementations
impl<T> From for T[src]
impl<T> From for Timpl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>try_from)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>try_from)Performs the conversion.
impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, fn borrow_mut(&mut self) -> &mut T[src]
fn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src]
fn get_type_id(&self) -> TypeId🔬 This is a nightly-only experimental API. (get_type_id)
this method will likely be replaced by an associated static
Gets the TypeId of self. Read more
impl<E> SpecializationError for E[src]
impl<E> SpecializationError for Efn not_found<S, T>(trait_name: &'static str, method_name: &'static str) -> E where
T: ?Sized, [src]
fn not_found<S, T>(trait_name: &'static str, method_name: &'static str) -> E where
T: ?Sized, 🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Create an error for a missing method specialization. Defaults to panicking with type, trait & method names. S is the encoder/decoder state type, T is the type being encoded/decoded, and the arguments are the names of the trait and method that should've been overridden. Read more
impl<T> Erased for T[src]
impl<T> Erased for Timpl<T> Send for T where
T: ?Sized, [src]
impl<T> Send for T where
T: ?Sized, impl<T> Sync for T where
T: ?Sized, [src]
impl<T> Sync for T where
T: ?Sized, impl<T> Erased for T
impl<T> Erased for T