pub fn fmt(&self, is_trait: bool, fmt: &mut Formatter) -> fmt::Result {
        if let Some(ref docs) = self.docs {
            docs.fmt(fmt)?;
        }

        if let Some(ref allow) = self.allow {
            write!(fmt, "#[allow({})]\n", allow)?;
        }

        for attr in self.attributes.iter() {
            write!(fmt, "#[{}]\n", attr)?;
        }

        if is_trait {
            assert!(
                self.vis.is_none(),
                "trait fns do not have visibility modifiers"
            );
        }

        if let Some(ref vis) = self.vis {
            write!(fmt, "{} ", vis)?;
        }

        if let Some(ref extern_abi) = self.extern_abi {
            write!(fmt, "extern \"{extern_abi}\" ", extern_abi = extern_abi)?;
        }

        write!(fmt, "fn {}", self.name)?;
        fmt_generics(&self.generics, fmt)?;

        write!(fmt, "(")?;

        if let Some(ref s) = self.arg_self {
            write!(fmt, "{}", s)?;
        }

        for (i, arg) in self.args.iter().enumerate() {
            if i != 0 || self.arg_self.is_some() {
                write!(fmt, ", ")?;
            }

            write!(fmt, "{}: ", arg.name)?;
            arg.ty.fmt(fmt)?;
        }

        write!(fmt, ")")?;

        if let Some(ref ret) = self.ret {
            write!(fmt, " -> ")?;
            ret.fmt(fmt)?;
        }

        fmt_bounds(&self.bounds, fmt)?;

        match self.body {
            Some(ref body) => fmt.block(|fmt| {
                for b in body {
                    b.fmt(fmt)?;
                }

                Ok(())
            }),
            None => {
                if !is_trait {
                    panic!("impl blocks must define fn bodies");
                }

                write!(fmt, ";\n")
            }
        }
    }
/// Formats the function using the given formatter.
Formats the function using the given formatter.
Formats the function using the given formatter .
pub fn fmt(&self, is_trait: bool, fmt: &mut Formatter) -> fmt::Result {
        if let Some(ref docs) = self.docs {
            docs.fmt(fmt)?;
        }
        if let Some(ref allow) = self.allow {
            write!(fmt, "#[allow({})]\n", allow)?;
        }
        for attr in self.attributes.iter() {
            write!(fmt, "#[{}]\n", attr)?;
        }
        if is_trait {
            assert!(
                self.vis.is_none(),
                "trait fns do not have visibility modifiers"
            );
        }
        if let Some(ref vis) = self.vis {
            write!(fmt, "{} ", vis)?;
        }
        if let Some(ref extern_abi) = self.extern_abi {
            write!(fmt, "extern \"{extern_abi}\" ", extern_abi = extern_abi)?;
        }
        write!(fmt, "fn {}", self.name)?;
        fmt_generics(&self.generics, fmt)?;
        write!(fmt, "(")?;
        if let Some(ref s) = self.arg_self {
            write!(fmt, "{}", s)?;
        }
        for (i, arg) in self.args.iter().enumerate() {
            if i != 0 || self.arg_self.is_some() {
                write!(fmt, ", ")?;
            }
            write!(fmt, "{}: ", arg.name)?;
            arg.ty.fmt(fmt)?;
        }
        write!(fmt, ")")?;
        if let Some(ref ret) = self.ret {
            write!(fmt, " -> ")?;
            ret.fmt(fmt)?;
        }
        fmt_bounds(&self.bounds, fmt)?;
        match self.body {
            Some(ref body) => fmt.block(|fmt| {
                for b in body {
                    b.fmt(fmt)?;
                }
                Ok(())
            }),
            None => {
                if !is_trait {
                    panic!("impl blocks must define fn bodies");
                }
                write!(fmt, ";\n")
            }
        }
    }
pub fn fmt ( & self , is_trait : bool , fmt : & mut Formatter ) -> fmt :: Result { if let Some ( ref docs ) = self . docs { docs . fmt ( fmt ) ? ; } if let Some ( ref allow ) = self . allow { write ! ( fmt " \n " allow ) ? ; } for attr in self . attributes . iter ( ) { write ! ( fmt " \n " attr ) ? ; } if is_trait { assert ! ( self vis is_none ( ) " " ) ; } if let Some ( ref vis ) = self . vis { write ! ( fmt " " vis ) ? ; } if let Some ( ref extern_abi ) = self . extern_abi { write ! ( fmt " \" \" " extern_abi extern_abi ) ? ; } write ! ( fmt " " self name ) ? ; fmt_generics ( & self . generics , fmt ) ? ; write ! ( fmt " " ) ? ; if let Some ( ref s ) = self . arg_self { write ! ( fmt " " s ) ? ; } for ( i , arg ) in self . args . iter ( ) . enumerate ( ) { if i != 0 || self . arg_self . is_some ( ) { write ! ( fmt " " ) ? ; } write ! ( fmt " " arg name ) ? ; arg . ty . fmt ( fmt ) ? ; } write ! ( fmt " " ) ? ; if let Some ( ref ret ) = self . ret { write ! ( fmt " " ) ? ; ret . fmt ( fmt ) ? ; } fmt_bounds ( & self . bounds , fmt ) ? ; match self . body { Some ( ref body ) => fmt . block ( | fmt | { for b in body { b . fmt ( fmt ) ? ; } Ok ( ( ) ) } ) , None => { if ! is_trait { panic ! ( " " ) ; } write ! ( fmt " \n " ) } } }
Formats the function using the given formatter.
Formats the function using the given formatter .
&self
is_trait
bool
fmt
&mut Formatter
&self
is_trait
bool
fmt
&mut Formatter