fn fmt()

in reverie-syscalls/src/args/mod.rs [310:339]


    fn fmt<M: MemoryAccess>(
        &self,
        memory: &M,
        outputs: bool,
        f: &mut fmt::Formatter,
    ) -> fmt::Result {
        match self {
            None => f.write_str("NULL"),
            Some(addr) => {
                if outputs {
                    match addr.read(memory) {
                        Ok(stat) => {
                            // Print st_mode the same way strace does.
                            let sflag = SFlag::from_bits_truncate(stat.st_mode);
                            let mode = Mode::from_bits_truncate(stat.st_mode);
                            write!(
                                f,
                                "{} -> {{st_mode={:?} | 0{:o}, st_size={}, ...}}",
                                addr.0, sflag, mode, stat.st_size
                            )
                        }
                        Err(e) => write!(f, "{} -> <{}>", addr.0, e),
                    }
                } else {
                    // Just print the address when not displaying outputs.
                    fmt::Display::fmt(&addr.0, f)
                }
            }
        }
    }