mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 02:00:51 +00:00
Fixing compile errors
This commit is contained in:
parent
2ee4c54f00
commit
fd88626e38
@ -128,20 +128,15 @@ vectors! {
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "enable-interning")] {
|
||||
#[inline]
|
||||
fn get_cached_str(x: &str) -> WasmSlice {
|
||||
if let Some(x) = crate::cache::intern::get_str(x) {
|
||||
// This uses 0 for the ptr as an indication that it is a JsValue and not a str
|
||||
WasmSlice { ptr: 0, len: x.into_abi() }
|
||||
|
||||
} else {
|
||||
x.into_bytes().into_abi()
|
||||
}
|
||||
fn get_cached_str(x: &str) -> Option<WasmSlice> {
|
||||
// This uses 0 for the ptr as an indication that it is a JsValue and not a str
|
||||
crate::cache::intern::get_str(x).map(|x| WasmSlice { ptr: 0, len: x.into_abi() })
|
||||
}
|
||||
|
||||
} else {
|
||||
#[inline]
|
||||
fn get_cached_str(x: &str) -> WasmSlice {
|
||||
x.into_bytes().into_abi()
|
||||
fn get_cached_str(_x: &str) -> Option<WasmSlice> {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -177,7 +172,7 @@ if_std! {
|
||||
|
||||
#[inline]
|
||||
fn into_abi(self) -> Self::Abi {
|
||||
get_cached_str(&self)
|
||||
get_cached_str(&self).unwrap_or_else(|| self.into_bytes().into_abi())
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,7 +200,7 @@ impl<'a> IntoWasmAbi for &'a str {
|
||||
|
||||
#[inline]
|
||||
fn into_abi(self) -> Self::Abi {
|
||||
get_cached_str(self)
|
||||
get_cached_str(self).unwrap_or_else(|| self.as_bytes().into_abi())
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user