pub fn restrict_lookahead<'a>(
        &'a mut self,
        lookahead: LookaheadRestriction,
    ) -> FormatterLock<'a> {
        let lookahead_restriction = self.lookahead_restriction;
        self.lookahead_restriction = Some(lookahead);

        FormatterLock::new(
            self,
            Box::new(move |fmt| {
                if let Some(_) = fmt.lookahead_restriction {
                    // If the previous lookahead got cleared, we don't want to restore
                    // any existing lookahead restrictions either.
                    fmt.lookahead_restriction = lookahead_restriction;
                }
            }),
        )
    }
/// Creates a formatter lock that will wrap the next expression in parentheses
/// if the expression begins with a sequence of tokens disallowed by the
/// given lookahead restriction.
Creates a formatter lock that will wrap the next expression in parentheses
if the expression begins with a sequence of tokens disallowed by the
given lookahead restriction.
Creates a formatter lock that will wrap the next expression in parentheses if the expression begins with a sequence of tokens disallowed by the given lookahead restriction .
pub fn restrict_lookahead<'a>(
        &'a mut self,
        lookahead: LookaheadRestriction,
    ) -> FormatterLock<'a> {
        let lookahead_restriction = self.lookahead_restriction;
        self.lookahead_restriction = Some(lookahead);
        FormatterLock::new(
            self,
            Box::new(move |fmt| {
                if let Some(_) = fmt.lookahead_restriction {
                    // If the previous lookahead got cleared, we don't want to restore
                    // any existing lookahead restrictions either.
                    fmt.lookahead_restriction = lookahead_restriction;
                }
            }),
        )
    }
pub fn restrict_lookahead < ' a > ( & ' a mut self , lookahead : LookaheadRestriction , ) -> FormatterLock < ' a > { let lookahead_restriction = self . lookahead_restriction ; self . lookahead_restriction = Some ( lookahead ) ; FormatterLock :: new ( self , Box :: new ( move | fmt | { if let Some ( _ ) = fmt . lookahead_restriction { // If the previous lookahead got cleared, we don't want to restore // any existing lookahead restrictions either. fmt . lookahead_restriction = lookahead_restriction ; } } ) , ) }
Creates a formatter lock that will wrap the next expression in parentheses
if the expression begins with a sequence of tokens disallowed by the
given lookahead restriction.
Creates a formatter lock that will wrap the next expression in parentheses if the expression begins with a sequence of tokens disallowed by the given lookahead restriction .
&'a mut self
lookahead
LookaheadRestriction