Skip to content

Commit

Permalink
feat(SourceCode): Implement SourceCode for Vec<u8> (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
Phantomical authored Nov 7, 2022
1 parent 3e25fd5 commit c857595
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/source_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ impl<'src> SourceCode for &'src [u8] {
}
}

impl SourceCode for Vec<u8> {
fn read_span<'a>(
&'a self,
span: &SourceSpan,
context_lines_before: usize,
context_lines_after: usize,
) -> Result<Box<dyn SpanContents<'a> + 'a>, MietteError> {
<[u8] as SourceCode>::read_span(self, span, context_lines_before, context_lines_after)
}
}

impl SourceCode for str {
fn read_span<'a>(
&'a self,
Expand Down

0 comments on commit c857595

Please sign in to comment.