pub struct CommentProcessor { /* private fields */ }Expand description
注释处理器,负责在格式化过程中处理注释
Implementations§
Source§impl CommentProcessor
impl CommentProcessor
pub fn new() -> Self
pub fn with_preserve_comments(self, preserve: bool) -> Self
pub fn with_format_comments(self, format: bool) -> Self
pub fn collector(&self) -> &CommentCollector
pub fn collector_mut(&mut self) -> &mut CommentCollector
Sourcepub fn process_comments(
&self,
comments: &[Comment],
indent: &str,
) -> Vec<String>
pub fn process_comments( &self, comments: &[Comment], indent: &str, ) -> Vec<String>
处理注释,返回格式化后的注释文本
Sourcepub fn insert_comments_at_position(
&self,
output: &mut String,
position: Position,
indent: &str,
)
pub fn insert_comments_at_position( &self, output: &mut String, position: Position, indent: &str, )
在指定位置插入注释
Sourcepub fn insert_trailing_comment(&self, output: &mut String, position: Position)
pub fn insert_trailing_comment(&self, output: &mut String, position: Position)
插入行尾注释
Trait Implementations§
Source§impl Clone for CommentProcessor
impl Clone for CommentProcessor
Source§fn clone(&self) -> CommentProcessor
fn clone(&self) -> CommentProcessor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CommentProcessor
impl Debug for CommentProcessor
Auto Trait Implementations§
impl Freeze for CommentProcessor
impl RefUnwindSafe for CommentProcessor
impl Send for CommentProcessor
impl Sync for CommentProcessor
impl Unpin for CommentProcessor
impl UnwindSafe for CommentProcessor
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