Implement SourceCode for Vec<u8>

This commit is contained in:
Phantomical 2022-10-30 10:32:09 -07:00
parent 3e25fd5b86
commit 775def6541
1 changed files with 11 additions and 0 deletions

View File

@ -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,