fix: impl From<Buffer> for Vec<u8>

This commit is contained in:
forehalo 2021-12-18 13:24:16 +08:00
parent 01b5a6dc3f
commit 2df97c108f
No known key found for this signature in database
GPG key ID: 64382C5AF49F3EB9
6 changed files with 20 additions and 1 deletions
crates/napi/src/bindgen_runtime/js_values

View file

@ -16,6 +16,12 @@ impl From<Vec<u8>> for Buffer {
}
}
impl From<Buffer> for Vec<u8> {
fn from(buf: Buffer) -> Self {
buf.inner.to_vec()
}
}
impl From<&[u8]> for Buffer {
fn from(inner: &[u8]) -> Self {
Buffer::from(inner.to_owned())