// Print out an object value on a line. There are three main variables at
// play here that determine what we should print out: the viewer mode,
// whether we're at the start or end of the container, and whether the
// container is expanded or collapsed. Whether the line is focused also
// determines the style in which the line is printed, but doesn't affect
// what actually gets printed.
//
// These are the 8 cases:
//
// Mode | Start/End |   State   |     Displayed
// -----+-----------+-----------+---------------------------
// Line |   Start   | Expanded  | Open char
// Line |   Start   | Collapsed | Preview + trailing comma?
// Line |    End    | Expanded  | Close char + trailing comma?
// Line |    End    | Collapsed | IMPOSSIBLE
// Data |   Start   | Expanded  | Preview
// Data |   Start   | Collapsed | Preview + trailing comma?
// Data |    End    | Expanded  | IMPOSSIBLE
// Data |    End    | Collapsed | IMPOSSIBLE
Print out an object value on a line. There are three main variables at
play here that determine what we should print out: the viewer mode,
whether we're at the start or end of the container, and whether the
container is expanded or collapsed. Whether the line is focused also
determines the style in which the line is printed, but doesn't affect
what actually gets printed.

These are the 8 cases.


Print out an object value on a line . There are three main variables at play here that determine what we should print out : the viewer mode whether we ' re at the start or end of the container and whether the container is expanded or collapsed . Whether the line is focused also determines the style in which the line is printed but doesn ' t affect what actually gets printed . These are the 8 cases .
fn fill_in_container_value<W: Write>(
        &self,
        buf: &mut W,
        available_space: isize,
        flatjson: &FlatJson,
        row: &Row,
    ) -> Result<isize, fmt::Error> {
        debug_assert!(row.is_container());
        let mode = self.mode;
        let side = row.is_opening_of_container();
        let expanded_state = row.is_expanded();
        const LINE: Mode = Mode::Line;
        const DATA: Mode = Mode::Data;
        const OPEN: bool = true;
        const CLOSE: bool = false;
        const EXPANDED: bool = true;
        const COLLAPSED: bool = false;
        match (mode, side, expanded_state) {
            (LINE, OPEN, EXPANDED) => self.fill_in_container_open_char(buf, available_space, row),
            (LINE, CLOSE, EXPANDED) => self.fill_in_container_close_char(buf, available_space, row),
            (LINE, OPEN, COLLAPSED) | (DATA, OPEN, EXPANDED) | (DATA, OPEN, COLLAPSED) => {
                self.fill_in_container_preview(buf, available_space, flatjson, row)
            }
            // Impossible states
            (LINE, CLOSE, COLLAPSED) => panic!("Can't focus closing of collapsed container"),
            (DATA, CLOSE, _) => panic!("Can't focus closing of container in Data mode"),
        }
    }
fn fill_in_container_value < W : Write > ( & self , buf : & mut W , available_space : isize , flatjson : & FlatJson , row : & Row , ) -> Result < isize , fmt :: Error > { debug_assert ! ( row is_container ( ) ) ; let mode = self . mode ; let side = row . is_opening_of_container ( ) ; let expanded_state = row . is_expanded ( ) ; const LINE : Mode = Mode :: Line ; const DATA : Mode = Mode :: Data ; const OPEN : bool = true ; const CLOSE : bool = false ; const EXPANDED : bool = true ; const COLLAPSED : bool = false ; match ( mode , side , expanded_state ) { ( LINE , OPEN , EXPANDED ) => self . fill_in_container_open_char ( buf , available_space , row ) , ( LINE , CLOSE , EXPANDED ) => self . fill_in_container_close_char ( buf , available_space , row ) , ( LINE , OPEN , COLLAPSED ) | ( DATA , OPEN , EXPANDED ) | ( DATA , OPEN , COLLAPSED ) => { self . fill_in_container_preview ( buf , available_space , flatjson , row ) } // Impossible states ( LINE , CLOSE , COLLAPSED ) => panic ! ( " " ) , ( DATA , CLOSE , _ ) => panic ! ( " " ) , } }
Print out an object value on a line.
Print out an object value on a line .
&self
buf
&mut W
available_space
isize
flatjson
&FlatJson
row
&Row