Skip to content

Commit c74a346

Browse files
committed
docs: Provide an example for Level::message
1 parent eb0d16d commit c74a346

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/level.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,20 @@ impl<'a> Level<'a> {
9191
/// used to normalize untrusted text before it is passed to this function.
9292
///
9393
/// </div>
94+
///
95+
/// # Example
96+
///
97+
/// ```rust
98+
/// # use annotate_snippets::{Group, Snippet, AnnotationKind, Level};
99+
/// let input = &[
100+
/// Group::with_title(Level::ERROR.title("mismatched types").id("E0308"))
101+
/// .element(
102+
/// Level::NOTE
103+
/// .no_name()
104+
/// .message("expected reference `&str`\nfound reference `&'static [u8; 0]`"),
105+
/// ),
106+
/// ];
107+
/// ```
94108
pub fn message(self, text: impl Into<Cow<'a, str>>) -> Message<'a> {
95109
Message {
96110
level: self,

0 commit comments

Comments
 (0)