Skip to content

Commit 6129319

Browse files
committed
docs: Provide an example for Origin
1 parent c74a346 commit 6129319

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/snippet.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,18 @@ impl<'a> Patch<'a> {
403403
/// A source location [`Element`] in a [`Group`]
404404
///
405405
/// If you have source available, see instead [`Snippet`]
406+
///
407+
/// # Example
408+
///
409+
/// ```rust
410+
/// # use annotate_snippets::{Group, Snippet, AnnotationKind, Level, Origin};
411+
/// let input = &[
412+
/// Group::with_title(Level::ERROR.title("mismatched types").id("E0308"))
413+
/// .element(
414+
/// Origin::new("$DIR/mismatched-types.rs")
415+
/// )
416+
/// ];
417+
/// ```
406418
#[derive(Clone, Debug)]
407419
pub struct Origin<'a> {
408420
pub(crate) path: Cow<'a, str>,

0 commit comments

Comments
 (0)