Fix strange new compile errors
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
c0e4702e45
commit
db88d31394
|
@ -24,7 +24,6 @@
|
||||||
#![feature(unboxed_closures)]
|
#![feature(unboxed_closures)]
|
||||||
#![feature(trait_upcasting)]
|
#![feature(trait_upcasting)]
|
||||||
#![feature(lazy_cell)]
|
#![feature(lazy_cell)]
|
||||||
#![feature(is_some_and)]
|
|
||||||
|
|
||||||
//! PkmnLib
|
//! PkmnLib
|
||||||
//! PkmnLib is a full featured implementation of Pokemon. while currently focused on implementing
|
//! PkmnLib is a full featured implementation of Pokemon. while currently focused on implementing
|
||||||
|
|
|
@ -13,7 +13,6 @@ use wasmer::FunctionEnvMut;
|
||||||
/// An Extern Ref allows us to pass objects to WASM without actually passing raw memory, or
|
/// An Extern Ref allows us to pass objects to WASM without actually passing raw memory, or
|
||||||
/// requiring us to make copies. Instead, we pass a simple increment index, that we can then use
|
/// requiring us to make copies. Instead, we pass a simple increment index, that we can then use
|
||||||
/// to find the relevant data.
|
/// to find the relevant data.
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub(crate) struct ExternRef<T: ?Sized> {
|
pub(crate) struct ExternRef<T: ?Sized> {
|
||||||
/// The lookup index we can use to find the data.
|
/// The lookup index we can use to find the data.
|
||||||
index: usize,
|
index: usize,
|
||||||
|
@ -21,6 +20,17 @@ pub(crate) struct ExternRef<T: ?Sized> {
|
||||||
_phantom: PhantomData<T>,
|
_phantom: PhantomData<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: ?Sized> Copy for ExternRef<T> {}
|
||||||
|
|
||||||
|
impl<T: ?Sized> Clone for ExternRef<T> {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
Self {
|
||||||
|
index: self.index,
|
||||||
|
_phantom: Default::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T: ValueIdentifiable + ?Sized> ExternRef<T> {
|
impl<T: ValueIdentifiable + ?Sized> ExternRef<T> {
|
||||||
/// Instantiates a new ExternRef for a bit of data. If we already have made an Extern Ref for
|
/// Instantiates a new ExternRef for a bit of data. If we already have made an Extern Ref for
|
||||||
/// this data and type, we use that instead.
|
/// this data and type, we use that instead.
|
||||||
|
@ -139,6 +149,16 @@ pub(crate) struct VecExternRef<T> {
|
||||||
_phantom: PhantomData<T>,
|
_phantom: PhantomData<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T> Clone for VecExternRef<T> {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
Self {
|
||||||
|
index: self.index,
|
||||||
|
size: self.size,
|
||||||
|
_phantom: Default::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T: 'static> VecExternRef<T> {
|
impl<T: 'static> VecExternRef<T> {
|
||||||
/// Instantiates a new VecExternRef for a given slice.
|
/// Instantiates a new VecExternRef for a given slice.
|
||||||
pub fn new(env: &WebAssemblyEnvironmentData, value: &Vec<T>) -> Self {
|
pub fn new(env: &WebAssemblyEnvironmentData, value: &Vec<T>) -> Self {
|
||||||
|
|
|
@ -51,11 +51,14 @@ macro_rules! script_function_cache {
|
||||||
{
|
{
|
||||||
let read_lock = self.$name.read();
|
let read_lock = self.$name.read();
|
||||||
if let Some(f) = read_lock.as_ref() {
|
if let Some(f) = read_lock.as_ref() {
|
||||||
return Some(f.clone());
|
return Some(TypedFunction::clone(f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.[<initialize_ $name>](env);
|
self.[<initialize_ $name>](env);
|
||||||
self.$name.read().as_ref().cloned()
|
match self.$name.read().as_ref() {
|
||||||
|
Some(f) => Some(TypedFunction::clone(f)),
|
||||||
|
None => None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)*
|
)*
|
||||||
|
|
Loading…
Reference in New Issue