1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
mod named;
mod newtype;
mod unnamed;

use super::*;

impl<'ty> Ctxt<'_, 'ty, '_> {
    pub(super) fn print_fields(
        &mut self,
        fields: &'ty Fields,
        variant: Option<&'ty Variant>,
    ) {
        if self.try_printing_newtype_fields(fields) {
            return;
        }

        match fields {
            Fields::Named { fields } => {
                self.print_named_fields(&fields, variant);
            }
            Fields::Unnamed { fields } => {
                self.print_unnamed_fields(&fields);
            }
            Fields::Unit => {
                self.out.write("null");
            }
        }
    }
}