fix(napi): remove into_*_ref from JsString

Close https://github.com/napi-rs/napi-rs/issues/411
This commit is contained in:
LongYinan 2021-01-07 11:13:47 +08:00
parent 1ee3145756
commit e24738a4d8
No known key found for this signature in database
GPG key ID: A3FFE134A3E20881
2 changed files with 2 additions and 21 deletions

View file

@ -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);

View file

@ -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;
@ -13,7 +11,6 @@ mod latin1;
mod utf16;
mod utf8;
#[derive(Clone, Copy)]
pub struct JsString(pub(crate) Value);
impl JsString {
@ -70,11 +67,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 +92,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 +117,4 @@ impl JsString {
}),
})
}
#[inline]
pub fn into_latin1_ref(self) -> Result<Ref<JsStringLatin1>> {
Ref::new(self.0, 1, self.into_latin1()?)
}
}