Skip to content

Commit a11cb40

Browse files
committed
Provide From<ByteView> for Slice construction
Analogous to From<Bytes> for slice_bytes.rs, to allow for zero-copy operations with existing ByteViews. #19
1 parent 0cd27e9 commit a11cb40

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/slice/slice_default.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,9 @@ impl From<String> for Slice {
5656
Self(ByteView::from(value.into_bytes()))
5757
}
5858
}
59+
60+
impl From<ByteView> for Slice {
61+
fn from(value: ByteView) -> Self {
62+
Self(value)
63+
}
64+
}

0 commit comments

Comments
 (0)