feat(napi): impl Clone + Copy for Primitive types

This commit is contained in:
LongYinan 2021-01-07 11:34:49 +08:00
parent e24738a4d8
commit c1215379f2
No known key found for this signature in database
GPG key ID: A3FFE134A3E20881
6 changed files with 7 additions and 0 deletions

View file

@ -4,6 +4,7 @@ use std::ptr;
use super::*; use super::*;
use crate::{check_status, sys, Result}; use crate::{check_status, sys, Result};
#[derive(Clone, Copy)]
pub struct JsBigint { pub struct JsBigint {
pub(crate) raw: Value, pub(crate) raw: Value,
pub word_count: usize, pub word_count: usize,

View file

@ -4,6 +4,7 @@ use super::Value;
use crate::check_status; use crate::check_status;
use crate::{sys, Error, Result}; use crate::{sys, Error, Result};
#[derive(Clone, Copy)]
pub struct JsBoolean(pub(crate) Value); pub struct JsBoolean(pub(crate) Value);
impl JsBoolean { impl JsBoolean {

View file

@ -61,8 +61,10 @@ pub use value_type::ValueType;
pub struct JsUnknown(pub(crate) Value); pub struct JsUnknown(pub(crate) Value);
#[derive(Clone, Copy)]
pub struct JsNull(pub(crate) Value); pub struct JsNull(pub(crate) Value);
#[derive(Clone, Copy)]
pub struct JsSymbol(pub(crate) Value); pub struct JsSymbol(pub(crate) Value);
pub struct JsExternal(pub(crate) Value); pub struct JsExternal(pub(crate) Value);

View file

@ -4,6 +4,7 @@ use super::Value;
use crate::check_status; use crate::check_status;
use crate::{sys, Error, Result}; use crate::{sys, Error, Result};
#[derive(Clone, Copy)]
pub struct JsNumber(pub(crate) Value); pub struct JsNumber(pub(crate) Value);
impl JsNumber { impl JsNumber {

View file

@ -11,6 +11,7 @@ mod latin1;
mod utf16; mod utf16;
mod utf8; mod utf8;
#[derive(Clone, Copy)]
pub struct JsString(pub(crate) Value); pub struct JsString(pub(crate) Value);
impl JsString { impl JsString {

View file

@ -1,3 +1,4 @@
use super::Value; use super::Value;
#[derive(Clone, Copy)]
pub struct JsUndefined(pub(crate) Value); pub struct JsUndefined(pub(crate) Value);