/// Write the "head" part of the terminator; that is, its name and the data it uses to pick the
/// successor basic block, if any. The only information not inlcuded is the list of possible
/// successors, which may be rendered differently between the text and the graphviz format.
Write the "head" part of the terminator; that is, its name and the data it uses to pick the
successor basic block, if any. The only information not inlcuded is the list of possible
successors, which may be rendered differently between the text and the graphviz format.
Write the " head " part of the terminator ; that is its name and the data it uses to pick the successor basic block if any . The only information not inlcuded is the list of possible successors which may be rendered differently between the text and the graphviz format .
pub fn fmt_head<W: Write>(&self, fmt: &mut W) -> fmt::Result {
        use self::TerminatorKind::*;
        match *self {
            Goto { .. } => write!(fmt, "goto"),
            If { cond: ref lv, .. } => write!(fmt, "if({:?})", lv),
            Switch { discr: ref lv, .. } => write!(fmt, "switch({:?})", lv),
            SwitchInt { discr: ref lv, .. } => write!(fmt, "switchInt({:?})", lv),
            Return => write!(fmt, "return"),
            Resume => write!(fmt, "resume"),
            Unreachable => write!(fmt, "unreachable"),
            Drop { ref location, .. } => write!(fmt, "drop({:?})", location),
            DropAndReplace { ref location, ref value, .. } =>
                write!(fmt, "replace({:?} <- {:?})", location, value),
            Call { ref func, ref args, ref destination, .. } => {
                if let Some((ref destination, _)) = *destination {
                    write!(fmt, "{:?} = ", destination)?;
                }
                write!(fmt, "{:?}(", func)?;
                for (index, arg) in args.iter().enumerate() {
                    if index > 0 {
                        write!(fmt, ", ")?;
                    }
                    write!(fmt, "{:?}", arg)?;
                }
                write!(fmt, ")")
            }
            Assert { ref cond, expected, ref msg, .. } => {
                write!(fmt, "assert(")?;
                if !expected {
                    write!(fmt, "!")?;
                }
                write!(fmt, "{:?}, ", cond)?;
                match *msg {
                    AssertMessage::BoundsCheck { ref len, ref index } => {
                        write!(fmt, "{:?}, {:?}, {:?}",
                               "index out of bounds: the len is {} but the index is {}",
                               len, index)?;
                    }
                    AssertMessage::Math(ref err) => {
                        write!(fmt, "{:?}", err.description())?;
                    }
                }
                write!(fmt, ")")
            }
        }
    }
pub fn fmt_head < W : Write > ( & self , fmt : & mut W ) -> fmt :: Result { use self :: TerminatorKind :: * ; match * self { Goto { .. } => write ! ( fmt " " ) , If { cond : ref lv , .. } => write ! ( fmt " " lv ) , Switch { discr : ref lv , .. } => write ! ( fmt " " lv ) , SwitchInt { discr : ref lv , .. } => write ! ( fmt " " lv ) , Return => write ! ( fmt " " ) , Resume => write ! ( fmt " " ) , Unreachable => write ! ( fmt " " ) , Drop { ref location , .. } => write ! ( fmt " " location ) , DropAndReplace { ref location , ref value , .. } => write ! ( fmt " " location value ) , Call { ref func , ref args , ref destination , .. } => { if let Some ( ( ref destination , _ ) ) = * destination { write ! ( fmt " " destination ) ? ; } write ! ( fmt " " func ) ? ; for ( index , arg ) in args . iter ( ) . enumerate ( ) { if index > 0 { write ! ( fmt " " ) ? ; } write ! ( fmt " " arg ) ? ; } write ! ( fmt " " ) } Assert { ref cond , expected , ref msg , .. } => { write ! ( fmt " " ) ? ; if ! expected { write ! ( fmt " " ) ? ; } write ! ( fmt " " cond ) ? ; match * msg { AssertMessage :: BoundsCheck { ref len , ref index } => { write ! ( fmt " " " " len index ) ? ; } AssertMessage :: Math ( ref err ) => { write ! ( fmt " " err description ( ) ) ? ; } } write ! ( fmt " " ) } } }
Write the "head" part of the terminator; that is, its name and the data it uses to pick the
successor basic block, if any.
Write the " head " part of the terminator ; that is its name and the data it uses to pick the successor basic block if any .
&self
fmt
&mut W