fn do_super(&mut self) -> Result<String> {
        let &(block_name, _, level) = self.blocks.last().unwrap();
        let mut next_level = level + 1;

        while next_level <= self.template.parents.len() {
            let blocks_definitions = &self
                .tera
                .get_template(&self.template.parents[next_level - 1])
                .unwrap()
                .blocks_definitions;

            if let Some(block_def) = blocks_definitions.get(block_name) {
                let (ref tpl_name, Block { ref body, .. }) = block_def[0];
                self.blocks.push((block_name, tpl_name, next_level));

                let res = self.render_body(body)?;
                self.blocks.pop();

                // Can't go any higher for that block anymore?
                if next_level >= self.template.parents.len() {
                    // then remove it from the stack, we're done with it
                    self.blocks.pop();
                }
                return Ok(res);
            } else {
                next_level += 1;
            }
        }

        bail!("Tried to use super() in the top level block")
    }
/// Only called while rendering a block.
/// This will look up the block we are currently rendering and its level and try to render
/// the block at level + n, where would be the next template in the hierarchy the block is present
Only called while rendering a block.
This will look up the block we are currently rendering and its level and try to render
the block at level + n, where would be the next template in the hierarchy the block is present
Only called while rendering a block . This will look up the block we are currently rendering and its level and try to render the block at level + n where would be the next template in the hierarchy the block is present
fn do_super(&mut self) -> Result<String> {
        let &(block_name, _, level) = self.blocks.last().unwrap();
        let mut next_level = level + 1;
        while next_level <= self.template.parents.len() {
            let blocks_definitions = &self
                .tera
                .get_template(&self.template.parents[next_level - 1])
                .unwrap()
                .blocks_definitions;
            if let Some(block_def) = blocks_definitions.get(block_name) {
                let (ref tpl_name, Block { ref body, .. }) = block_def[0];
                self.blocks.push((block_name, tpl_name, next_level));
                let res = self.render_body(body)?;
                self.blocks.pop();
                // Can't go any higher for that block anymore?
                if next_level >= self.template.parents.len() {
                    // then remove it from the stack, we're done with it
                    self.blocks.pop();
                }
                return Ok(res);
            } else {
                next_level += 1;
            }
        }
        bail!("Tried to use super() in the top level block")
    }
fn do_super ( & mut self ) -> Result < String > { let & ( block_name , _ , level ) = self . blocks . last ( ) . unwrap ( ) ; let mut next_level = level + 1 ; while next_level <= self . template . parents . len ( ) { let blocks_definitions = & self . tera . get_template ( & self . template . parents [ next_level - 1 ] ) . unwrap ( ) . blocks_definitions ; if let Some ( block_def ) = blocks_definitions . get ( block_name ) { let ( ref tpl_name , Block { ref body , .. } ) = block_def [ 0 ] ; self . blocks . push ( ( block_name , tpl_name , next_level ) ) ; let res = self . render_body ( body ) ? ; self . blocks . pop ( ) ; // Can't go any higher for that block anymore? if next_level >= self . template . parents . len ( ) { // then remove it from the stack, we're done with it self . blocks . pop ( ) ; } return Ok ( res ) ; } else { next_level += 1 ; } } bail ! ( " " ) }
Only called while rendering a block.
Only called while rendering a block .
&mut self
&mut self