Skip to content

Commit c857595

Browse files
authoredNov 7, 2022
feat(SourceCode): Implement SourceCode for Vec<u8> (#216)
1 parent 3e25fd5 commit c857595

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

‎src/source_impls.rs

+11
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,17 @@ impl<'src> SourceCode for &'src [u8] {
119119
}
120120
}
121121

122+
impl SourceCode for Vec<u8> {
123+
fn read_span<'a>(
124+
&'a self,
125+
span: &SourceSpan,
126+
context_lines_before: usize,
127+
context_lines_after: usize,
128+
) -> Result<Box<dyn SpanContents<'a> + 'a>, MietteError> {
129+
<[u8] as SourceCode>::read_span(self, span, context_lines_before, context_lines_after)
130+
}
131+
}
132+
122133
impl SourceCode for str {
123134
fn read_span<'a>(
124135
&'a self,

0 commit comments

Comments
 (0)
Please sign in to comment.