pub struct FormatDriver<'a> { /* private fields */ }Expand description
Driver that writes the syntax tree to a string by visiting tokens.
You can use [format] directly, or build a custom flow with walk(root, &mut driver, &opts).
Implementations§
Source§impl<'a> FormatDriver<'a>
impl<'a> FormatDriver<'a>
pub fn new(options: &'a FormatterOptions) -> Self
pub fn into_string(self) -> String
Trait Implementations§
Source§impl Visitor for FormatDriver<'_>
impl Visitor for FormatDriver<'_>
Source§fn visit_token(&mut self, token: &SyntaxToken) -> WalkResult
fn visit_token(&mut self, token: &SyntaxToken) -> WalkResult
Called for each token when
WalkOptions::visit_tokens is true.
Trivia is included only when WalkOptions::visit_trivia is true.Source§fn enter_node(&mut self, _node: &SyntaxNode) -> ControlFlow<()>
fn enter_node(&mut self, _node: &SyntaxNode) -> ControlFlow<()>
Called before visiting this node’s children (pre-order).
Source§fn leave_node(&mut self, _node: &SyntaxNode) -> ControlFlow<()>
fn leave_node(&mut self, _node: &SyntaxNode) -> ControlFlow<()>
Called after visiting this node’s children (post-order).
Auto Trait Implementations§
impl<'a> Freeze for FormatDriver<'a>
impl<'a> RefUnwindSafe for FormatDriver<'a>
impl<'a> Send for FormatDriver<'a>
impl<'a> Sync for FormatDriver<'a>
impl<'a> Unpin for FormatDriver<'a>
impl<'a> UnsafeUnpin for FormatDriver<'a>
impl<'a> UnwindSafe for FormatDriver<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more