pub struct CommentCollector { /* private fields */ }Expand description
注释收集器,用于从源码中提取注释
Implementations§
Source§impl CommentCollector
impl CommentCollector
pub fn new() -> Self
pub fn add_comment(&mut self, comment: Comment)
pub fn comments(&self) -> &[Comment]
pub fn comments_mut(&mut self) -> &mut Vec<Comment>
Sourcepub fn comments_before(&self, position: Position) -> Vec<&Comment>
pub fn comments_before(&self, position: Position) -> Vec<&Comment>
获取指定位置之前的注释
Sourcepub fn comments_after(&self, position: Position) -> Vec<&Comment>
pub fn comments_after(&self, position: Position) -> Vec<&Comment>
获取指定位置之后的注释
Sourcepub fn trailing_comments(&self) -> Vec<&Comment>
pub fn trailing_comments(&self) -> Vec<&Comment>
获取行尾注释
Sourcepub fn sort_by_position(&mut self)
pub fn sort_by_position(&mut self)
按位置排序注释
Trait Implementations§
Source§impl Clone for CommentCollector
impl Clone for CommentCollector
Source§fn clone(&self) -> CommentCollector
fn clone(&self) -> CommentCollector
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 CommentCollector
impl Debug for CommentCollector
Source§impl Default for CommentCollector
impl Default for CommentCollector
Source§impl PartialEq for CommentCollector
impl PartialEq for CommentCollector
impl StructuralPartialEq for CommentCollector
Auto Trait Implementations§
impl Freeze for CommentCollector
impl RefUnwindSafe for CommentCollector
impl Send for CommentCollector
impl Sync for CommentCollector
impl Unpin for CommentCollector
impl UnwindSafe for CommentCollector
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