Skip to content

Commit be1f041

Browse files
committed
implemented setters for comment text and spans
1 parent 813dea1 commit be1f041

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/comments.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ impl CommentKind {
102102
Self::MultiLine(comment) | Self::SingleLine(comment) => comment,
103103
}
104104
}
105+
/// Setter method for setting the comment value
106+
pub fn set_comment(&mut self, text: &str) {
107+
match self {
108+
Self::MultiLine(s) | Self::SingleLine(s) => {
109+
*s = text.to_owned();
110+
}
111+
}
112+
}
105113
}
106114

107115
/// Structure for containing the [`CommentKind`] and the [`Span`] for a comment

0 commit comments

Comments
 (0)