pub struct Comment {
pub kind: CommentKind,
pub content: String,
pub span: SourceSpan,
pub is_trailing: bool,
pub indent_level: usize,
}Expand description
注释信息
Fields§
§kind: CommentKind注释类型
content: String注释内容(不包含注释标记)
span: SourceSpan注释在源码中的位置
is_trailing: bool是否在行尾
indent_level: usize缩进级别
Implementations§
Source§impl Comment
impl Comment
pub fn new(kind: CommentKind, content: String, span: SourceSpan) -> Self
pub fn line(content: String, span: SourceSpan) -> Self
pub fn block(content: String, span: SourceSpan) -> Self
pub fn doc(content: String, span: SourceSpan) -> Self
pub fn with_trailing(self, is_trailing: bool) -> Self
pub fn with_indent_level(self, level: usize) -> Self
Sourcepub fn formatted_text(&self, indent: &str) -> String
pub fn formatted_text(&self, indent: &str) -> String
获取格式化后的注释文本
Trait Implementations§
impl StructuralPartialEq for Comment
Auto Trait Implementations§
impl Freeze for Comment
impl RefUnwindSafe for Comment
impl Send for Comment
impl Sync for Comment
impl Unpin for Comment
impl UnwindSafe for Comment
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