pub fn emit(w: &mut impl Write) -> Result