1use rustc_data_structures::fx::FxHashMap;
2use rustc_macros::{Decodable, Encodable, Walkable};
3use rustc_span::{Ident, Span, Symbol};
4
5use crate::Expr;
6use crate::token::LitKind;
7
8#[derive(#[automatically_derived]
impl ::core::clone::Clone for FormatArgs {
#[inline]
fn clone(&self) -> Self {
Self {
span: ::core::clone::Clone::clone(&self.span),
template: ::core::clone::Clone::clone(&self.template),
arguments: ::core::clone::Clone::clone(&self.arguments),
uncooked_fmt_str: ::core::clone::Clone::clone(&self.uncooked_fmt_str),
is_source_literal: ::core::clone::Clone::clone(&self.is_source_literal),
}
}
}Clone, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for FormatArgs {
fn encode(&self, __encoder: &mut __E) {
let FormatArgs {
span: ref __binding_0,
template: ref __binding_1,
arguments: ref __binding_2,
uncooked_fmt_str: ref __binding_3,
is_source_literal: ref __binding_4 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_4,
__encoder);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for FormatArgs {
fn decode(__decoder: &mut __D) -> Self {
FormatArgs {
span: ::rustc_serialize::Decodable::decode(__decoder),
template: ::rustc_serialize::Decodable::decode(__decoder),
arguments: ::rustc_serialize::Decodable::decode(__decoder),
uncooked_fmt_str: ::rustc_serialize::Decodable::decode(__decoder),
is_source_literal: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};Decodable, #[automatically_derived]
impl ::core::fmt::Debug for FormatArgs {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f, "FormatArgs",
"span", &self.span, "template", &self.template, "arguments",
&self.arguments, "uncooked_fmt_str", &self.uncooked_fmt_str,
"is_source_literal", &&self.is_source_literal)
}
}Debug, const _: () =
{
impl<'__ast, __V> crate::visit::Walkable<'__ast, __V> for FormatArgs
where __V: crate::visit::Visitor<'__ast> {
fn walk_ref(&'__ast self, __visitor: &mut __V) -> __V::Result {
match *self {
FormatArgs {
span: ref __binding_0,
template: ref __binding_1,
arguments: ref __binding_2,
uncooked_fmt_str: ref __binding_3,
is_source_literal: ref __binding_4 } => {
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_0,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_1,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_2,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_3,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_4,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as rustc_ast_ir::visit::VisitorResult>::output()
}
}
impl<__V> crate::mut_visit::MutWalkable<__V> for FormatArgs where
__V: crate::mut_visit::MutVisitor {
fn walk_mut(&mut self, __visitor: &mut __V) {
match *self {
FormatArgs {
span: ref mut __binding_0,
template: ref mut __binding_1,
arguments: ref mut __binding_2,
uncooked_fmt_str: ref mut __binding_3,
is_source_literal: ref mut __binding_4 } => {
{
crate::mut_visit::MutVisitable::visit_mut(__binding_0,
__visitor, ())
}
{
crate::mut_visit::MutVisitable::visit_mut(__binding_1,
__visitor, ())
}
{
crate::mut_visit::MutVisitable::visit_mut(__binding_2,
__visitor, ())
}
{
crate::mut_visit::MutVisitable::visit_mut(__binding_3,
__visitor, ())
}
{
crate::mut_visit::MutVisitable::visit_mut(__binding_4,
__visitor, ())
}
}
}
}
}
};Walkable)]
44pub struct FormatArgs {
45 pub span: Span,
47 pub template: Vec<FormatArgsPiece>,
48 pub arguments: FormatArguments,
49 pub uncooked_fmt_str: (LitKind, Symbol),
53 pub is_source_literal: bool,
61}
62
63#[derive(#[automatically_derived]
impl ::core::clone::Clone for FormatArgsPiece {
#[inline]
fn clone(&self) -> Self {
match self {
Self::Literal(__self_0) =>
Self::Literal(::core::clone::Clone::clone(__self_0)),
Self::Placeholder(__self_0) =>
Self::Placeholder(::core::clone::Clone::clone(__self_0)),
}
}
}Clone, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for FormatArgsPiece {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
FormatArgsPiece::Literal(ref __binding_0) => { 0usize }
FormatArgsPiece::Placeholder(ref __binding_0) => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
FormatArgsPiece::Literal(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
FormatArgsPiece::Placeholder(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for FormatArgsPiece {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
FormatArgsPiece::Literal(::rustc_serialize::Decodable::decode(__decoder))
}
1usize => {
FormatArgsPiece::Placeholder(::rustc_serialize::Decodable::decode(__decoder))
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `FormatArgsPiece`, expected 0..2, actual {0}",
n));
}
}
}
}
};Decodable, #[automatically_derived]
impl ::core::fmt::Debug for FormatArgsPiece {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Literal(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Literal", &__self_0),
Self::Placeholder(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Placeholder", &__self_0),
}
}
}Debug, const _: () =
{
impl<'__ast, __V> crate::visit::Walkable<'__ast, __V> for
FormatArgsPiece where __V: crate::visit::Visitor<'__ast> {
fn walk_ref(&'__ast self, __visitor: &mut __V) -> __V::Result {
match *self {
FormatArgsPiece::Literal(ref __binding_0) => {
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_0,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
}
FormatArgsPiece::Placeholder(ref __binding_0) => {
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_0,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as rustc_ast_ir::visit::VisitorResult>::output()
}
}
impl<__V> crate::mut_visit::MutWalkable<__V> for FormatArgsPiece where
__V: crate::mut_visit::MutVisitor {
fn walk_mut(&mut self, __visitor: &mut __V) {
match *self {
FormatArgsPiece::Literal(ref mut __binding_0) => {
{
crate::mut_visit::MutVisitable::visit_mut(__binding_0,
__visitor, ())
}
}
FormatArgsPiece::Placeholder(ref mut __binding_0) => {
{
crate::mut_visit::MutVisitable::visit_mut(__binding_0,
__visitor, ())
}
}
}
}
}
};Walkable)]
67pub enum FormatArgsPiece {
68 Literal(Symbol),
69 Placeholder(FormatPlaceholder),
70}
71
72#[derive(#[automatically_derived]
impl ::core::clone::Clone for FormatArguments {
#[inline]
fn clone(&self) -> Self {
Self {
arguments: ::core::clone::Clone::clone(&self.arguments),
num_unnamed_args: ::core::clone::Clone::clone(&self.num_unnamed_args),
num_explicit_args: ::core::clone::Clone::clone(&self.num_explicit_args),
names: ::core::clone::Clone::clone(&self.names),
}
}
}Clone, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for FormatArguments {
fn encode(&self, __encoder: &mut __E) {
let FormatArguments {
arguments: ref __binding_0,
num_unnamed_args: ref __binding_1,
num_explicit_args: ref __binding_2,
names: ref __binding_3 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for FormatArguments {
fn decode(__decoder: &mut __D) -> Self {
FormatArguments {
arguments: ::rustc_serialize::Decodable::decode(__decoder),
num_unnamed_args: ::rustc_serialize::Decodable::decode(__decoder),
num_explicit_args: ::rustc_serialize::Decodable::decode(__decoder),
names: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};Decodable, #[automatically_derived]
impl ::core::fmt::Debug for FormatArguments {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"FormatArguments", "arguments", &self.arguments,
"num_unnamed_args", &self.num_unnamed_args, "num_explicit_args",
&self.num_explicit_args, "names", &&self.names)
}
}Debug, const _: () =
{
impl<'__ast, __V> crate::visit::Walkable<'__ast, __V> for
FormatArguments where __V: crate::visit::Visitor<'__ast> {
fn walk_ref(&'__ast self, __visitor: &mut __V) -> __V::Result {
match *self {
FormatArguments {
arguments: ref __binding_0,
num_unnamed_args: ref __binding_1,
num_explicit_args: ref __binding_2,
names: ref __binding_3 } => {
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_0,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_1,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_2,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_3,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as rustc_ast_ir::visit::VisitorResult>::output()
}
}
impl<__V> crate::mut_visit::MutWalkable<__V> for FormatArguments where
__V: crate::mut_visit::MutVisitor {
fn walk_mut(&mut self, __visitor: &mut __V) {
match *self {
FormatArguments {
arguments: ref mut __binding_0,
num_unnamed_args: ref mut __binding_1,
num_explicit_args: ref mut __binding_2,
names: ref mut __binding_3 } => {
{
crate::mut_visit::MutVisitable::visit_mut(__binding_0,
__visitor, ())
}
{
crate::mut_visit::MutVisitable::visit_mut(__binding_1,
__visitor, ())
}
{
crate::mut_visit::MutVisitable::visit_mut(__binding_2,
__visitor, ())
}
{
crate::mut_visit::MutVisitable::visit_mut(__binding_3,
__visitor, ())
}
}
}
}
}
};Walkable)]
77pub struct FormatArguments {
78 arguments: Vec<FormatArgument>,
79 num_unnamed_args: usize,
80 num_explicit_args: usize,
81 names: FxHashMap<Symbol, usize>,
82}
83
84impl FormatArguments {
85 pub fn new() -> Self {
86 Self {
87 arguments: Vec::new(),
88 names: FxHashMap::default(),
89 num_unnamed_args: 0,
90 num_explicit_args: 0,
91 }
92 }
93
94 pub fn add(&mut self, arg: FormatArgument) -> usize {
95 let index = self.arguments.len();
96 if let Some(name) = arg.kind.ident() {
97 self.names.insert(name.name, index);
98 } else if self.names.is_empty() {
99 self.num_unnamed_args += 1;
102 }
103 if !#[allow(non_exhaustive_omitted_patterns)] match arg.kind {
FormatArgumentKind::Captured(..) => true,
_ => false,
}matches!(arg.kind, FormatArgumentKind::Captured(..)) {
104 {
match (&self.num_explicit_args, &self.arguments.len()) {
(left_val, right_val) => {
if !(*left_val == *right_val) {
let kind = ::core::panicking::AssertKind::Eq;
::core::panicking::assert_failed(kind, &*left_val,
&*right_val,
::core::option::Option::Some(format_args!("captured arguments must be added last")));
}
}
}
};assert_eq!(
107 self.num_explicit_args,
108 self.arguments.len(),
109 "captured arguments must be added last"
110 );
111 self.num_explicit_args += 1;
112 }
113 self.arguments.push(arg);
114 index
115 }
116
117 pub fn by_name(&self, name: Symbol) -> Option<(usize, &FormatArgument)> {
118 let i = *self.names.get(&name)?;
119 Some((i, &self.arguments[i]))
120 }
121
122 pub fn by_index(&self, i: usize) -> Option<&FormatArgument> {
123 (i < self.num_explicit_args).then(|| &self.arguments[i])
124 }
125
126 pub fn unnamed_args(&self) -> &[FormatArgument] {
127 &self.arguments[..self.num_unnamed_args]
128 }
129
130 pub fn named_args(&self) -> &[FormatArgument] {
131 &self.arguments[self.num_unnamed_args..self.num_explicit_args]
132 }
133
134 pub fn explicit_args(&self) -> &[FormatArgument] {
135 &self.arguments[..self.num_explicit_args]
136 }
137
138 pub fn all_args(&self) -> &[FormatArgument] {
139 &self.arguments[..]
140 }
141
142 pub fn all_args_mut(&mut self) -> &mut Vec<FormatArgument> {
143 &mut self.arguments
144 }
145}
146
147#[derive(#[automatically_derived]
impl ::core::clone::Clone for FormatArgument {
#[inline]
fn clone(&self) -> Self {
Self {
original_span: ::core::clone::Clone::clone(&self.original_span),
kind: ::core::clone::Clone::clone(&self.kind),
expr: ::core::clone::Clone::clone(&self.expr),
}
}
}Clone, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for FormatArgument {
fn encode(&self, __encoder: &mut __E) {
let FormatArgument {
original_span: ref __binding_0,
kind: ref __binding_1,
expr: ref __binding_2 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for FormatArgument {
fn decode(__decoder: &mut __D) -> Self {
FormatArgument {
original_span: ::rustc_serialize::Decodable::decode(__decoder),
kind: ::rustc_serialize::Decodable::decode(__decoder),
expr: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};Decodable, #[automatically_derived]
impl ::core::fmt::Debug for FormatArgument {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"FormatArgument", "original_span", &self.original_span, "kind",
&self.kind, "expr", &&self.expr)
}
}Debug, const _: () =
{
impl<'__ast, __V> crate::visit::Walkable<'__ast, __V> for
FormatArgument where __V: crate::visit::Visitor<'__ast> {
fn walk_ref(&'__ast self, __visitor: &mut __V) -> __V::Result {
match *self {
FormatArgument {
original_span: ref __binding_0,
kind: ref __binding_1,
expr: ref __binding_2 } => {
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_0,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_1,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_2,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as rustc_ast_ir::visit::VisitorResult>::output()
}
}
impl<__V> crate::mut_visit::MutWalkable<__V> for FormatArgument where
__V: crate::mut_visit::MutVisitor {
fn walk_mut(&mut self, __visitor: &mut __V) {
match *self {
FormatArgument {
original_span: ref mut __binding_0,
kind: ref mut __binding_1,
expr: ref mut __binding_2 } => {
{
crate::mut_visit::MutVisitable::visit_mut(__binding_0,
__visitor, ())
}
{
crate::mut_visit::MutVisitable::visit_mut(__binding_1,
__visitor, ())
}
{
crate::mut_visit::MutVisitable::visit_mut(__binding_2,
__visitor, ())
}
}
}
}
}
};Walkable)]
148pub struct FormatArgument {
149 pub original_span: Span,
153 pub kind: FormatArgumentKind,
154 pub expr: Box<Expr>,
155}
156
157#[derive(#[automatically_derived]
impl ::core::clone::Clone for FormatArgumentKind {
#[inline]
fn clone(&self) -> Self {
match self {
Self::Normal => Self::Normal,
Self::Named(__self_0) =>
Self::Named(::core::clone::Clone::clone(__self_0)),
Self::Captured(__self_0) =>
Self::Captured(::core::clone::Clone::clone(__self_0)),
}
}
}Clone, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for FormatArgumentKind {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
FormatArgumentKind::Normal => { 0usize }
FormatArgumentKind::Named(ref __binding_0) => { 1usize }
FormatArgumentKind::Captured(ref __binding_0) => { 2usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
FormatArgumentKind::Normal => {}
FormatArgumentKind::Named(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
FormatArgumentKind::Captured(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for FormatArgumentKind {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { FormatArgumentKind::Normal }
1usize => {
FormatArgumentKind::Named(::rustc_serialize::Decodable::decode(__decoder))
}
2usize => {
FormatArgumentKind::Captured(::rustc_serialize::Decodable::decode(__decoder))
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `FormatArgumentKind`, expected 0..3, actual {0}",
n));
}
}
}
}
};Decodable, #[automatically_derived]
impl ::core::fmt::Debug for FormatArgumentKind {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Normal => ::core::fmt::Formatter::write_str(f, "Normal"),
Self::Named(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Named",
&__self_0),
Self::Captured(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Captured", &__self_0),
}
}
}Debug, const _: () =
{
impl<'__ast, __V> crate::visit::Walkable<'__ast, __V> for
FormatArgumentKind where __V: crate::visit::Visitor<'__ast> {
fn walk_ref(&'__ast self, __visitor: &mut __V) -> __V::Result {
match *self {
FormatArgumentKind::Normal => {}
FormatArgumentKind::Named(ref __binding_0) => {
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_0,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
}
FormatArgumentKind::Captured(ref __binding_0) => {
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_0,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as rustc_ast_ir::visit::VisitorResult>::output()
}
}
impl<__V> crate::mut_visit::MutWalkable<__V> for FormatArgumentKind
where __V: crate::mut_visit::MutVisitor {
fn walk_mut(&mut self, __visitor: &mut __V) {
match *self {
FormatArgumentKind::Normal => {}
FormatArgumentKind::Named(ref mut __binding_0) => {
{
crate::mut_visit::MutVisitable::visit_mut(__binding_0,
__visitor, ())
}
}
FormatArgumentKind::Captured(ref mut __binding_0) => {
{
crate::mut_visit::MutVisitable::visit_mut(__binding_0,
__visitor, ())
}
}
}
}
}
};Walkable)]
158pub enum FormatArgumentKind {
159 Normal,
161 Named(Ident),
163 Captured(Ident),
165}
166
167impl FormatArgumentKind {
168 pub fn ident(&self) -> Option<Ident> {
169 match self {
170 &Self::Normal => None,
171 &Self::Named(id) => Some(id),
172 &Self::Captured(id) => Some(id),
173 }
174 }
175}
176
177#[derive(#[automatically_derived]
impl ::core::clone::Clone for FormatPlaceholder {
#[inline]
fn clone(&self) -> Self {
Self {
argument: ::core::clone::Clone::clone(&self.argument),
span: ::core::clone::Clone::clone(&self.span),
format_trait: ::core::clone::Clone::clone(&self.format_trait),
format_options: ::core::clone::Clone::clone(&self.format_options),
}
}
}Clone, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for FormatPlaceholder {
fn encode(&self, __encoder: &mut __E) {
let FormatPlaceholder {
argument: ref __binding_0,
span: ref __binding_1,
format_trait: ref __binding_2,
format_options: ref __binding_3 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for FormatPlaceholder {
fn decode(__decoder: &mut __D) -> Self {
FormatPlaceholder {
argument: ::rustc_serialize::Decodable::decode(__decoder),
span: ::rustc_serialize::Decodable::decode(__decoder),
format_trait: ::rustc_serialize::Decodable::decode(__decoder),
format_options: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};Decodable, #[automatically_derived]
impl ::core::fmt::Debug for FormatPlaceholder {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"FormatPlaceholder", "argument", &self.argument, "span",
&self.span, "format_trait", &self.format_trait, "format_options",
&&self.format_options)
}
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for FormatPlaceholder { }
#[automatically_derived]
impl ::core::cmp::PartialEq for FormatPlaceholder {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.argument == other.argument && self.span == other.span &&
self.format_trait == other.format_trait &&
self.format_options == other.format_options
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for FormatPlaceholder {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<FormatArgPosition>;
let _: ::core::cmp::AssertParamIsEq<Option<Span>>;
let _: ::core::cmp::AssertParamIsEq<FormatTrait>;
let _: ::core::cmp::AssertParamIsEq<FormatOptions>;
}
}Eq, const _: () =
{
impl<'__ast, __V> crate::visit::Walkable<'__ast, __V> for
FormatPlaceholder where __V: crate::visit::Visitor<'__ast> {
fn walk_ref(&'__ast self, __visitor: &mut __V) -> __V::Result {
match *self {
FormatPlaceholder {
argument: ref __binding_0,
span: ref __binding_1,
format_trait: ref __binding_2,
format_options: ref __binding_3 } => {
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_0,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_1,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
{}
{}
}
}
<__V::Result as rustc_ast_ir::visit::VisitorResult>::output()
}
}
impl<__V> crate::mut_visit::MutWalkable<__V> for FormatPlaceholder
where __V: crate::mut_visit::MutVisitor {
fn walk_mut(&mut self, __visitor: &mut __V) {
match *self {
FormatPlaceholder {
argument: ref mut __binding_0,
span: ref mut __binding_1,
format_trait: ref mut __binding_2,
format_options: ref mut __binding_3 } => {
{
crate::mut_visit::MutVisitable::visit_mut(__binding_0,
__visitor, ())
}
{
crate::mut_visit::MutVisitable::visit_mut(__binding_1,
__visitor, ())
}
{}
{}
}
}
}
}
};Walkable)]
178pub struct FormatPlaceholder {
179 pub argument: FormatArgPosition,
181 pub span: Option<Span>,
183 #[visitable(ignore)]
185 pub format_trait: FormatTrait,
186 #[visitable(ignore)]
188 pub format_options: FormatOptions,
189}
190
191#[derive(#[automatically_derived]
impl ::core::clone::Clone for FormatArgPosition {
#[inline]
fn clone(&self) -> Self {
Self {
index: ::core::clone::Clone::clone(&self.index),
kind: ::core::clone::Clone::clone(&self.kind),
span: ::core::clone::Clone::clone(&self.span),
}
}
}Clone, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for FormatArgPosition {
fn encode(&self, __encoder: &mut __E) {
let FormatArgPosition {
index: ref __binding_0,
kind: ref __binding_1,
span: ref __binding_2 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for FormatArgPosition {
fn decode(__decoder: &mut __D) -> Self {
FormatArgPosition {
index: ::rustc_serialize::Decodable::decode(__decoder),
kind: ::rustc_serialize::Decodable::decode(__decoder),
span: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};Decodable, #[automatically_derived]
impl ::core::fmt::Debug for FormatArgPosition {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"FormatArgPosition", "index", &self.index, "kind", &self.kind,
"span", &&self.span)
}
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for FormatArgPosition { }
#[automatically_derived]
impl ::core::cmp::PartialEq for FormatArgPosition {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.index == other.index && self.kind == other.kind &&
self.span == other.span
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for FormatArgPosition {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<Result<usize, usize>>;
let _: ::core::cmp::AssertParamIsEq<FormatArgPositionKind>;
let _: ::core::cmp::AssertParamIsEq<Option<Span>>;
}
}Eq, const _: () =
{
impl<'__ast, __V> crate::visit::Walkable<'__ast, __V> for
FormatArgPosition where __V: crate::visit::Visitor<'__ast> {
fn walk_ref(&'__ast self, __visitor: &mut __V) -> __V::Result {
match *self {
FormatArgPosition {
index: ref __binding_0,
kind: ref __binding_1,
span: ref __binding_2 } => {
{}
{}
{
match ::rustc_ast_ir::visit::VisitorResult::branch(crate::visit::Visitable::visit(__binding_2,
__visitor, ())) {
core::ops::ControlFlow::Continue(()) =>
(),
#[allow(unreachable_code)]
core::ops::ControlFlow::Break(r) => {
return ::rustc_ast_ir::visit::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as rustc_ast_ir::visit::VisitorResult>::output()
}
}
impl<__V> crate::mut_visit::MutWalkable<__V> for FormatArgPosition
where __V: crate::mut_visit::MutVisitor {
fn walk_mut(&mut self, __visitor: &mut __V) {
match *self {
FormatArgPosition {
index: ref mut __binding_0,
kind: ref mut __binding_1,
span: ref mut __binding_2 } => {
{}
{}
{
crate::mut_visit::MutVisitable::visit_mut(__binding_2,
__visitor, ())
}
}
}
}
}
};Walkable)]
192pub struct FormatArgPosition {
193 #[visitable(ignore)]
196 pub index: Result<usize, usize>,
197 #[visitable(ignore)]
199 pub kind: FormatArgPositionKind,
200 pub span: Option<Span>,
202}
203
204#[derive(#[automatically_derived]
impl ::core::marker::Copy for FormatArgPositionKind { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for FormatArgPositionKind { }
#[automatically_derived]
impl ::core::clone::Clone for FormatArgPositionKind {
#[inline]
fn clone(&self) -> Self { *self }
}Clone, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for FormatArgPositionKind {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
FormatArgPositionKind::Implicit => { 0usize }
FormatArgPositionKind::Number => { 1usize }
FormatArgPositionKind::Named => { 2usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for FormatArgPositionKind {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { FormatArgPositionKind::Implicit }
1usize => { FormatArgPositionKind::Number }
2usize => { FormatArgPositionKind::Named }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `FormatArgPositionKind`, expected 0..3, actual {0}",
n));
}
}
}
}
};Decodable, #[automatically_derived]
impl ::core::fmt::Debug for FormatArgPositionKind {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
FormatArgPositionKind::Implicit => "Implicit",
FormatArgPositionKind::Number => "Number",
FormatArgPositionKind::Named => "Named",
})
}
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for FormatArgPositionKind { }
#[automatically_derived]
impl ::core::cmp::PartialEq for FormatArgPositionKind {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other)
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for FormatArgPositionKind { }Eq)]
205pub enum FormatArgPositionKind {
206 Implicit,
208 Number,
210 Named,
212}
213
214#[derive(#[automatically_derived]
impl ::core::marker::Copy for FormatTrait { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for FormatTrait { }
#[automatically_derived]
impl ::core::clone::Clone for FormatTrait {
#[inline]
fn clone(&self) -> Self { *self }
}Clone, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for FormatTrait {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
FormatTrait::Display => { 0usize }
FormatTrait::Debug => { 1usize }
FormatTrait::LowerExp => { 2usize }
FormatTrait::UpperExp => { 3usize }
FormatTrait::Octal => { 4usize }
FormatTrait::Pointer => { 5usize }
FormatTrait::Binary => { 6usize }
FormatTrait::LowerHex => { 7usize }
FormatTrait::UpperHex => { 8usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for FormatTrait {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { FormatTrait::Display }
1usize => { FormatTrait::Debug }
2usize => { FormatTrait::LowerExp }
3usize => { FormatTrait::UpperExp }
4usize => { FormatTrait::Octal }
5usize => { FormatTrait::Pointer }
6usize => { FormatTrait::Binary }
7usize => { FormatTrait::LowerHex }
8usize => { FormatTrait::UpperHex }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `FormatTrait`, expected 0..9, actual {0}",
n));
}
}
}
}
};Decodable, #[automatically_derived]
impl ::core::fmt::Debug for FormatTrait {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
FormatTrait::Display => "Display",
FormatTrait::Debug => "Debug",
FormatTrait::LowerExp => "LowerExp",
FormatTrait::UpperExp => "UpperExp",
FormatTrait::Octal => "Octal",
FormatTrait::Pointer => "Pointer",
FormatTrait::Binary => "Binary",
FormatTrait::LowerHex => "LowerHex",
FormatTrait::UpperHex => "UpperHex",
})
}
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for FormatTrait { }
#[automatically_derived]
impl ::core::cmp::PartialEq for FormatTrait {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other)
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for FormatTrait { }Eq, #[automatically_derived]
impl ::core::hash::Hash for FormatTrait {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state)
}
}Hash)]
215pub enum FormatTrait {
216 Display,
218 Debug,
220 LowerExp,
222 UpperExp,
224 Octal,
226 Pointer,
228 Binary,
230 LowerHex,
232 UpperHex,
234}
235
236#[derive(#[automatically_derived]
impl ::core::clone::Clone for FormatOptions {
#[inline]
fn clone(&self) -> Self {
Self {
width: ::core::clone::Clone::clone(&self.width),
precision: ::core::clone::Clone::clone(&self.precision),
alignment: ::core::clone::Clone::clone(&self.alignment),
fill: ::core::clone::Clone::clone(&self.fill),
sign: ::core::clone::Clone::clone(&self.sign),
alternate: ::core::clone::Clone::clone(&self.alternate),
zero_pad: ::core::clone::Clone::clone(&self.zero_pad),
debug_hex: ::core::clone::Clone::clone(&self.debug_hex),
}
}
}Clone, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for FormatOptions {
fn encode(&self, __encoder: &mut __E) {
let FormatOptions {
width: ref __binding_0,
precision: ref __binding_1,
alignment: ref __binding_2,
fill: ref __binding_3,
sign: ref __binding_4,
alternate: ref __binding_5,
zero_pad: ref __binding_6,
debug_hex: ref __binding_7 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_4,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_5,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_6,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_7,
__encoder);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for FormatOptions {
fn decode(__decoder: &mut __D) -> Self {
FormatOptions {
width: ::rustc_serialize::Decodable::decode(__decoder),
precision: ::rustc_serialize::Decodable::decode(__decoder),
alignment: ::rustc_serialize::Decodable::decode(__decoder),
fill: ::rustc_serialize::Decodable::decode(__decoder),
sign: ::rustc_serialize::Decodable::decode(__decoder),
alternate: ::rustc_serialize::Decodable::decode(__decoder),
zero_pad: ::rustc_serialize::Decodable::decode(__decoder),
debug_hex: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};Decodable, #[automatically_derived]
impl ::core::default::Default for FormatOptions {
#[inline]
fn default() -> Self {
Self {
width: ::core::default::Default::default(),
precision: ::core::default::Default::default(),
alignment: ::core::default::Default::default(),
fill: ::core::default::Default::default(),
sign: ::core::default::Default::default(),
alternate: ::core::default::Default::default(),
zero_pad: ::core::default::Default::default(),
debug_hex: ::core::default::Default::default(),
}
}
}Default, #[automatically_derived]
impl ::core::fmt::Debug for FormatOptions {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["width", "precision", "alignment", "fill", "sign", "alternate",
"zero_pad", "debug_hex"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.width, &self.precision, &self.alignment, &self.fill,
&self.sign, &self.alternate, &self.zero_pad,
&&self.debug_hex];
::core::fmt::Formatter::debug_struct_fields_finish(f, "FormatOptions",
names, values)
}
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for FormatOptions { }
#[automatically_derived]
impl ::core::cmp::PartialEq for FormatOptions {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.alternate == other.alternate && self.zero_pad == other.zero_pad
&& self.width == other.width &&
self.precision == other.precision &&
self.alignment == other.alignment && self.fill == other.fill
&& self.sign == other.sign &&
self.debug_hex == other.debug_hex
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for FormatOptions {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<Option<FormatCount>>;
let _: ::core::cmp::AssertParamIsEq<Option<FormatCount>>;
let _: ::core::cmp::AssertParamIsEq<Option<FormatAlignment>>;
let _: ::core::cmp::AssertParamIsEq<Option<char>>;
let _: ::core::cmp::AssertParamIsEq<Option<FormatSign>>;
let _: ::core::cmp::AssertParamIsEq<bool>;
let _: ::core::cmp::AssertParamIsEq<Option<FormatDebugHex>>;
}
}Eq)]
237pub struct FormatOptions {
238 pub width: Option<FormatCount>,
240 pub precision: Option<FormatCount>,
242 pub alignment: Option<FormatAlignment>,
244 pub fill: Option<char>,
246 pub sign: Option<FormatSign>,
248 pub alternate: bool,
250 pub zero_pad: bool,
252 pub debug_hex: Option<FormatDebugHex>,
254}
255
256#[derive(#[automatically_derived]
impl ::core::marker::Copy for FormatSign { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for FormatSign { }
#[automatically_derived]
impl ::core::clone::Clone for FormatSign {
#[inline]
fn clone(&self) -> Self { *self }
}Clone, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for FormatSign {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
FormatSign::Plus => { 0usize }
FormatSign::Minus => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for FormatSign {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { FormatSign::Plus }
1usize => { FormatSign::Minus }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `FormatSign`, expected 0..2, actual {0}",
n));
}
}
}
}
};Decodable, #[automatically_derived]
impl ::core::fmt::Debug for FormatSign {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
FormatSign::Plus => "Plus",
FormatSign::Minus => "Minus",
})
}
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for FormatSign { }
#[automatically_derived]
impl ::core::cmp::PartialEq for FormatSign {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other)
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for FormatSign { }Eq)]
257pub enum FormatSign {
258 Plus,
260 Minus,
262}
263
264#[derive(#[automatically_derived]
impl ::core::marker::Copy for FormatDebugHex { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for FormatDebugHex { }
#[automatically_derived]
impl ::core::clone::Clone for FormatDebugHex {
#[inline]
fn clone(&self) -> Self { *self }
}Clone, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for FormatDebugHex {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
FormatDebugHex::Lower => { 0usize }
FormatDebugHex::Upper => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for FormatDebugHex {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { FormatDebugHex::Lower }
1usize => { FormatDebugHex::Upper }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `FormatDebugHex`, expected 0..2, actual {0}",
n));
}
}
}
}
};Decodable, #[automatically_derived]
impl ::core::fmt::Debug for FormatDebugHex {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
FormatDebugHex::Lower => "Lower",
FormatDebugHex::Upper => "Upper",
})
}
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for FormatDebugHex { }
#[automatically_derived]
impl ::core::cmp::PartialEq for FormatDebugHex {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other)
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for FormatDebugHex { }Eq)]
265pub enum FormatDebugHex {
266 Lower,
268 Upper,
270}
271
272#[derive(#[automatically_derived]
impl ::core::marker::Copy for FormatAlignment { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for FormatAlignment { }
#[automatically_derived]
impl ::core::clone::Clone for FormatAlignment {
#[inline]
fn clone(&self) -> Self { *self }
}Clone, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for FormatAlignment {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
FormatAlignment::Left => { 0usize }
FormatAlignment::Right => { 1usize }
FormatAlignment::Center => { 2usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for FormatAlignment {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { FormatAlignment::Left }
1usize => { FormatAlignment::Right }
2usize => { FormatAlignment::Center }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `FormatAlignment`, expected 0..3, actual {0}",
n));
}
}
}
}
};Decodable, #[automatically_derived]
impl ::core::fmt::Debug for FormatAlignment {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
FormatAlignment::Left => "Left",
FormatAlignment::Right => "Right",
FormatAlignment::Center => "Center",
})
}
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for FormatAlignment { }
#[automatically_derived]
impl ::core::cmp::PartialEq for FormatAlignment {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other)
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for FormatAlignment { }Eq)]
273pub enum FormatAlignment {
274 Left,
276 Right,
278 Center,
280}
281
282#[derive(#[automatically_derived]
impl ::core::clone::Clone for FormatCount {
#[inline]
fn clone(&self) -> Self {
match self {
Self::Literal(__self_0) =>
Self::Literal(::core::clone::Clone::clone(__self_0)),
Self::Argument(__self_0) =>
Self::Argument(::core::clone::Clone::clone(__self_0)),
}
}
}Clone, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for FormatCount {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
FormatCount::Literal(ref __binding_0) => { 0usize }
FormatCount::Argument(ref __binding_0) => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
FormatCount::Literal(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
FormatCount::Argument(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for FormatCount {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
FormatCount::Literal(::rustc_serialize::Decodable::decode(__decoder))
}
1usize => {
FormatCount::Argument(::rustc_serialize::Decodable::decode(__decoder))
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `FormatCount`, expected 0..2, actual {0}",
n));
}
}
}
}
};Decodable, #[automatically_derived]
impl ::core::fmt::Debug for FormatCount {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Literal(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Literal", &__self_0),
Self::Argument(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Argument", &__self_0),
}
}
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for FormatCount { }
#[automatically_derived]
impl ::core::cmp::PartialEq for FormatCount {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::Literal(__self_0), Self::Literal(__arg1_0)) =>
__self_0 == __arg1_0,
(Self::Argument(__self_0), Self::Argument(__arg1_0)) =>
__self_0 == __arg1_0,
_ => unsafe { ::core::intrinsics::unreachable() }
}
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for FormatCount {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<u16>;
let _: ::core::cmp::AssertParamIsEq<FormatArgPosition>;
}
}Eq)]
283pub enum FormatCount {
284 Literal(u16),
286 Argument(FormatArgPosition),
288}