pub trait WithComments: Sized {
// Required methods
fn comments(&self) -> &[String];
fn add_comment<S>(&mut self, comment: S)
where S: Into<String>;
// Provided methods
fn with_comment<S>(self, comment: S) -> Self
where S: Into<String> { ... }
fn write_comments(
&self,
comment_type: CommentType,
b: &mut CodeBuffer,
level: usize,
) { ... }
}Expand description
An element with comment lines.
Required Methods§
Sourcefn add_comment<S>(&mut self, comment: S)
fn add_comment<S>(&mut self, comment: S)
Adds the comment line.
Provided Methods§
Sourcefn with_comment<S>(self, comment: S) -> Self
fn with_comment<S>(self, comment: S) -> Self
Adds the comment line.
Sourcefn write_comments(
&self,
comment_type: CommentType,
b: &mut CodeBuffer,
level: usize,
)
fn write_comments( &self, comment_type: CommentType, b: &mut CodeBuffer, level: usize, )
Writes the comment lines.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.