pub fn format_expr_header_with_layout(
expr: &Expr,
source: &str,
depth: usize,
bounds: (LineColumn, LineColumn),
column: usize,
width: usize,
suffix_columns: usize,
) -> StringExpand description
Formats a brace-reserving header at column, reserving suffix_columns on its last line.
The target width includes the already-written prefix and following punctuation. Continuations
nest four spaces from depth; unbreakable tokens and comments may exceed width.
- Precondition:
sourceis the parsed source andboundsenclosesexpr, or source is empty. - Complexity: O(n) document space plus layout and existing source-gap scans.
ยงExamples
use cel_parser::{AstContext, OpLookup, Parser, format_expr_header_with_layout, LineColumn};
let source = "value";
let expr = Parser::<AstContext>::new(OpLookup::new()).parse_str_ast(source).unwrap();
assert_eq!(format_expr_header_with_layout(&expr, source, 1,
(LineColumn { line: 1, column: 0 }, LineColumn { line: 1, column: 5 }),
16, 100, 2), "value");