feat(SourceCode): Implement SourceCode for Vec<u8> (#216)

This commit is contained in:
Sean Lynch 2022-11-06 17:42:33 -08:00 committed by GitHub
parent 3e25fd5b86
commit c857595e1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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,