feat(napi): impl Default for Buffer (#1734)

This commit is contained in:
Özgür Akkurt 2023-11-02 17:32:13 +03:00 committed by GitHub
parent b19ada79fd
commit 2c410b238d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,6 +92,12 @@ impl Clone for Buffer {
}
}
impl Default for Buffer {
fn default() -> Self {
Self::from(Vec::default())
}
}
impl From<Vec<u8>> for Buffer {
fn from(mut data: Vec<u8>) -> Self {
let inner_ptr = data.as_mut_ptr();