Merge pull request #412 from napi-rs/remove-string-ref
fix(napi): remove into_*_ref from JsString
This commit is contained in:
commit
8f9a77fd38
7 changed files with 8 additions and 20 deletions
|
@ -4,8 +4,7 @@ use std::os::raw::c_void;
|
|||
use std::ptr;
|
||||
use std::slice;
|
||||
|
||||
use super::{Value, ValueType};
|
||||
use crate::{check_status, sys, JsUnknown, NapiValue, Ref, Result};
|
||||
use crate::{check_status, sys, JsUnknown, NapiValue, Ref, Result, Value, ValueType};
|
||||
|
||||
pub struct JsArrayBuffer(pub(crate) Value);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ use std::ptr;
|
|||
use super::*;
|
||||
use crate::{check_status, sys, Result};
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct JsBigint {
|
||||
pub(crate) raw: Value,
|
||||
pub word_count: usize,
|
||||
|
|
|
@ -4,6 +4,7 @@ use super::Value;
|
|||
use crate::check_status;
|
||||
use crate::{sys, Error, Result};
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct JsBoolean(pub(crate) Value);
|
||||
|
||||
impl JsBoolean {
|
||||
|
|
|
@ -61,8 +61,10 @@ pub use value_type::ValueType;
|
|||
|
||||
pub struct JsUnknown(pub(crate) Value);
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct JsNull(pub(crate) Value);
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct JsSymbol(pub(crate) Value);
|
||||
|
||||
pub struct JsExternal(pub(crate) Value);
|
||||
|
|
|
@ -4,6 +4,7 @@ use super::Value;
|
|||
use crate::check_status;
|
||||
use crate::{sys, Error, Result};
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct JsNumber(pub(crate) Value);
|
||||
|
||||
impl JsNumber {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
use super::Value;
|
||||
use crate::check_status;
|
||||
use crate::{sys, Ref, Result};
|
||||
use crate::{check_status, sys, Result, Value};
|
||||
|
||||
pub use latin1::JsStringLatin1;
|
||||
pub use utf16::JsStringUtf16;
|
||||
|
@ -70,11 +68,6 @@ impl JsString {
|
|||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn into_utf8_ref(self) -> Result<Ref<JsStringUtf8>> {
|
||||
Ref::new(self.0, 1, self.into_utf8()?)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn into_utf16(self) -> Result<JsStringUtf16> {
|
||||
let mut written_char_count = 0usize;
|
||||
|
@ -100,11 +93,6 @@ impl JsString {
|
|||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn into_utf16_ref(self) -> Result<Ref<JsStringUtf16>> {
|
||||
Ref::new(self.0, 1, self.into_utf16()?)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn into_latin1(self) -> Result<JsStringLatin1> {
|
||||
let mut written_char_count = 0usize;
|
||||
|
@ -130,9 +118,4 @@ impl JsString {
|
|||
}),
|
||||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn into_latin1_ref(self) -> Result<Ref<JsStringLatin1>> {
|
||||
Ref::new(self.0, 1, self.into_latin1()?)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use super::Value;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct JsUndefined(pub(crate) Value);
|
||||
|
|
Loading…
Reference in a new issue